Application of Comparator Based on AT89C2051 Single Chip Microcomputer

Publisher:cheng1984Latest update time:2012-05-10 Source: 21IC Keywords:AT89C2051 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

A special application of AT89C2051, using its comparator to make a light intensity regulator, applied to a fully static LED display. The original situation is that the light control of the original LED display is made of a dedicated AD conversion chip, which is relatively expensive. Finally, this solution was used as a patch.

Its working principle is: use the comparator of the single-chip computer, capacitor and photoresistor to form a charge and discharge circuit, and use the two timers of the single-chip computer to form a PWM signal output. The PWM signal is output from a port, and then controls the display enable signal of the LED display, so that the LED display can be darker at night and brighter at night, so as to achieve the best effect.

ORG 0000H
LJMP MAIN
ORG 000BH
LJMP TIMER0 ;Change the duty cycle
ORG 001BH
LJMP TIMER1 ;Timing 10MS
ORG 0030H
MAIN: MOV SP,#70H
MOV P1,#0FFH
CLR P1.1
MOV P3,#0FFH
MOV TMOD,#11H
MOV IE,#8AH
MOV TH1,#0DCH ;Timing 10MS, scanning frequency 100HZ
MOV TL1,#00H
MOV TH0,#00H ;Change the brightness duty cycle according to the light intensity
MOV TL0,#00H
MOV 30H,#00H
MOV 31H,#00H
MOV 32H,#50 ;Cooperate with timer 1 to complete the start of light detection time 500MS
;MOV 33H,#5
MOV 34H,#055H ;Ten seconds up flag, 055H is time up
; MOV 35H,#0AAH ;Start comparator flag, 55H is start
SETB TR1
MAIN1: SETB ET0
CPL P1.4
MOV A,34H
CJNE A,#55H,MAIN1
MOV 34H,#0AAH
CLR TR0
CLR ET0
MOV TH0,#00H
MOV TL0,#00H
SETB TR0
SETB P1.1
JB P3.6,$
CLR TR0
SETB P3.7
CLR P1.1
CPL P1.5
MOV 30H,TH0
MOV 31H,TL0
MOV A,#0FFH
CLR C
SUBB A,31H
MOV 31H,A
MOV A,#0FFH
SUBB A,30H
MOV 30H,A
LJMP MAIN1


TIMER1: PUSH ACC
MOV TH1,#0DCH
MOV TL1,#00H
MOV TH0,30H
MOV TL0,31H
SETB TR0
CLR P3.7
CPL P1.7
DJNZ 32H,T1ZD1
MOV 32H,#50
MOV 34H,#55H ;500MS
T1ZD1: POP ACC
RETI

TIMER0: PUSH ACC
C LR TR0
MOV TH0,30H
MOV TL0,31H
SETB P3.7
cpl p1.6
POP ACC
RETI

END

Keywords:AT89C2051 Reference address:Application of Comparator Based on AT89C2051 Single Chip Microcomputer

Previous article:Design of control system for bathing service robot based on single chip microcomputer
Next article:Data acquisition and storage circuit based on C8051F320 USB interface

Recommended ReadingLatest update time:2024-11-16 19:58

Basic Principles and Design Applications of Voltage Comparator
This article mainly introduces the basic concepts, working principles and typical working circuits of voltage comparators , and introduces some commonly used voltage comparators. Voltage comparator (hereinafter referred to as comparator) is a commonly used integrated circuit . It can
[Power Management]
Basic Principles and Design Applications of Voltage Comparator
Design of automatic spinning yarn breakage detection system based on AT89C2051 microcontroller
introduction During the winding process of the spinning machine, it is very important to determine whether the thin thread is broken. Therefore, the spinning breakage detection device is a product that emerged based on actual needs. It can detect and monitor the spinning process. This article designs a multifunctional
[Microcontroller]
Design of automatic spinning yarn breakage detection system based on AT89C2051 microcontroller
AT89C2051 multi-channel servo control circuit
A servo is a position servo driver . It receives a certain control signal and outputs a certain angle. It is suitable for control systems that require the angle to be constantly changed and maintained. In micro-electromechanical systems and aircraft models, it is a basic output actuator. Taking the FUTABA-S3003 servo a
[Microcontroller]
AT89C2051 multi-channel servo control circuit
2051 comparator analog AD source program (C language)
2051 comparator analog AD source program (C language) /* io allocation: * ;* OUTPUT: * ;* P1.0 ...... analog input * ;* P1.1 ...... DA input comparison reference voltage     * ;* P1.2~7..... R-2R DA resistor network * ;* P3.7 ......  LED  analog brightness output * ;* CPU C LOC K EQU 6M */ //xiaoqi last edit in 2001.1
[Microcontroller]
PC/AT Keyboard Designed with AT89C2051
In the fields of industrial control and measuring instruments, embedded PCs have been widely used, such as PC/104 from ADVANTECH and E86 embedded PC from AMD. In addition to the functions of PCs, they also provide powerful standard interfaces, such as flat panel/VGA display control interface, optical drive interface
[Microcontroller]
PC/AT Keyboard Designed with AT89C2051
A New Current Limit Comparator
1. Introduction Switching power supplies have been widely used in the fields of electronics, electrical equipment, and home appliances due to their small size, light weight, high efficiency, and stable performance, and have entered a period of rapid development. The basic working principle of a switching power
[Power Management]
A New Current Limit Comparator
Development of a temperature controller for foot bath
The difficulty in designing a foot bather lies in cost control and the design of a temperature control system. In recent years, the gradual maturity of switching power supply technology has provided a high-efficiency and low-cost solution for low-power power supply, abandoning the traditional low-efficiency power suppl
[Microcontroller]
Development of a temperature controller for foot bath
Digital setting, comparator with reference voltage of 0.1~9.9V
Function of the circuit The reference voltage of the comparison circuit is mostly obtained by dividing the power supply voltage with resistors. This method is suitable for the case where the reference voltage does not need to be adjusted once it is selected. If the reference voltage can be change
[Analog Electronics]
Digital setting, comparator with reference voltage of 0.1~9.9V
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号