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
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
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How is this kind of PCB wiring designed using AD? Please give me some guidance, masters!
- EEWORLD University ---- Quartus Prime Development Process (Intel Official Tutorial)
- Issues with STM32L15xCC
- Access control panel with Bluetooth low energy and capacitive touch technology
- The eighth chapter of the Altera series of the struggling child of Zhixin Technology: Verilog basic syntax.pdf
- VDA6.7-CN (Process Audit)
- TI DSP command file CMD
- [A-Current Signal Detection Device] Sichuan Province-Second Prize
- IoT Smart Lights
- The problem of static electricity