;Key points: Application of counters
; Set the timer to 50ms, and set two software counters to 20 and 60 for the total time
; 50ms*20*60=60000ms=1 minute
; t1 is mode 1, then m1m0=01h, use timer c/t=0 gate=0 TMOD=10H
; Mode 1 is a 16-bit counter, a total of 65535, minus 50000 equals 15536, so the initial value of the counter is 3cb0h
ORG 0000H; program starts
LJMP MAIN
ORG 030H
MAIN:
MOV 30H, #20; 30h, 31h set constants 20, 60 respectively
MOV 31H,#60;
MOV TMOD,#10H;Timer mode 1
MOV TH1,#03CH; Set the timer initial value
MOV TL1,#0B0H
MOV IE,#00H; Disable interrupts
SETB TR1; Start timer
LOOP:
JBC TF1, LOOP1; query timer time is up and switch to loop1
AJMP LOOP
LOOP1:
MOV TH1,#03CH; reset timer
MOV TL1,#0B0H
DJNZ 30H,LOOP; Is the timing reached 20 times?
MOV 30H,#20
DJNZ 31H, LOOP; Is the timing up to 60 times?
MOV 31H,#60
CPL P1.0; invert p1.0
AJMP LOOP
END
The status of the program running in the Yitian version: the program is completely destroyed after running
The program is running in the Yitian version:
p10 lights up after 1 minute, achieving a long delay
Previous article:Control lights with buttons
Next article:Nesting of subroutines
- Popular Resources
- Popular amplifiers
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- How Qorvo implements 5G self-shielding technology
- What is the difference between the main control MCU and the touch control IC?
- Smart Electricity Meter
- Welcome to join the EEWorld official QQ group/WeChat group!
- TI battery protection and fuel gauge solutions explained
- A strange question about an experiment in Yu Zhennan's book
- [Live Preview] The old hands of the electronics competition say | The second live broadcast of Puyuan Jingdian's electronics competition coaching
- Some knowledge about GPS [Repost]
- What is "j" in the resultant vector formula of three-phase symmetrical sinusoidal current?
- PCB design Bluetooth speaker practical case │Package transfer and common errors