At this time, there are separate interrupts when the lower 8 bits and the upper 8 bits overflow
tl0 occupies T0
th0 occupies T1
The two counters are independent
/*
Program function: timer0 verification program
Version: v1
Creation date: 2013.9.18
creator:
*/
$NOMOD51 //Cancel the use of 51 internal default SFR
#include "REG8F301.INC"
dseg at 30h //General RAM byte segment starts at 30H
iseg at 80h //0-ffh address RAM segment 80h-ffh segment RAM can only be operated using indirect addressing
cseg at 0
org 0000h
jmp Start
org 000bh
jmp Timer0_Isr
org001bh
jmp Timer_Isr //TH0 is now occupying timer 1
org 0030h
start:
mov r0,#0x7f
ClrRam: //Clear internal 256Byte RAM
mov @r0,#0
djnz r0,ClrRam
mov dptr,#0x00 //Clear external 768Byte RAM
ClrOutRam:
mov a,#0x00 //Write all 0x00 to external RAM
movx @dptr,a
inc dpl
mov a,dpl
cjne a,#0,ClrOutRam
inc dph
mov a,dph
cjne a,#3,ClrOutRam
SetTimer0:
mov tmod,#03h //Timer 1 works in mode 1
mov th0,#HIGH(256-100)
mov tl0,#LOW(256-100)
setb tr0 //Start timer 0 counting
setb et0 //Enable timer 1 interrupt
setb tr1 //Start timer 1 counting
setb et1 //Enable timer 1 interrupt
setbea
main:
ljmp main
Timer0_Isr:
push acc
push psw
mov tl0,#LOW(256-100)
nop
nop
pop psw
pop acc
reti
Timer_Isr:
push acc
push psw
mov th0,#LOW(256-100)
nop
nop
pop psw
pop acc
reti
end
Previous article:Usage of R8051XC2 Timer 2
Next article:C51 MCU interrupt number and interrupt vector
- Popular Resources
- Popular amplifiers
- Example interpretation of 51 single chip microcomputer complete learning and application
- Practice of Serial Communication between Single Chip Microcomputer and Computer (Zhang Xiuguan)
- Example interpretation of 51 single chip microcomputer complete learning and application
- Integrated wireless transceiver & 8-bit RISC (reduced instruction set) MCU SOC chip Ci2451
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
- China's latest classification catalogue of medical devices (No. 104, 2017)
- What is the function of the cross connection of the five tubes in the middle of this comparator?
- Understanding of TIMERA timing interrupt of MSP430F149
- What is the difference between pyb.delay and time.sleep?
- Stepper motor current test
- [RVB2601 creative application development] + light intensity detection
- 【DIY Creative LED】Effect Demonstration
- [GD32450I-EVAL] USART and DMA variable length reception
- ESP32-S3 Technical Reference Manual Latest Manual
- 【DSP】TMS320F28035 ADC routine (software trigger + query)