;Knowledge point: Application of interruption; 1khz means inverting once every 500us
; t1 is mode 0, then m1m0=00h, use timer c/t=0 gate=0
; Mode 0 is a 13-bit timer, the total time is 2 to the 13th power of microseconds. = 8192 microseconds, minus 500 microseconds = 7692
;1111000001100 is converted to hexadecimal, the high 8 bits are equal to 0fh and the low 8 bits are 0ch
; Note: These two fields are not continuous. The lower 8 bits 01100 are filled with 0 before calculation.
;For beginners, please practice more to master the calculation method, and use an oscilloscope to check the frequency if possible
; The basic condition for interrupt response is that there is an interrupt request, the corresponding position of the interrupt enable register is 1, and the total interrupt open ea=1
;Once the response is interrupted, only the breakpoint is protected but not the scene, so the scene should be protected in general.
ORG 0000H;
LJMP MAIN;
ORG 001BH; jump to interrupt entry
LJMP INSER; to the interrupt service routine
ORG 030H;
MAIN:
MOV TMOD,#00H;ti working mode 0
MOV TH1,#0F0H; load initial value
MOV TL1,#0CH;
SETB EA; Enable interrupt
SETB ET1; Timer t1 is enabled
LOOP:
SETB TR1; start timer
HERE:
SJMP HERE; Wait for interrupt, virtual main program, other programs can be inserted here
ORG 0200H; interrupt service routine starts from 200h
INSER:
MOV TH1,#0F0H; reload the timing initial value
MOV TL1,#0CH;
CPL P3.3; reverse small speaker
RETI; interrupt return
Previous article:Application of counter
Next article:Interrupt response, two-level interrupt nesting, interrupt priority setting
- 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!
- 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
- I have never understood several parameters of MOS tubes. Please help me explain them.
- Luminous flux of LED after aging
- Image storage and display system based on SDRAM——Study record
- The smallest Arduino board
- Wi-Fi 6E front-end module: Perfectly demonstrates all the performance of the 6GHz band
- Design of wireless intelligent air conditioning control system peripheral circuit using ZigBee technology
- The static digital tube display problem of 51 single chip microcomputer in Puzhong
- 【Application development based on NUCLEO-F746ZG motor】3. Hardware connection and motor identification
- There was an earthquake
- [Mill MYB-YT507 development board trial experience] tkinter Button learning