#include
sbit out=P1^0;
void main()
{
//T0 timer, working mode 2. Its interrupt function makes the out pin output pulse
//T1 counter, working mode 1. Its interrupt function makes P2 output pulse
TMOD=0x52;
//Interrupt enable
ET0=1;
ET1=1;
EA=1;
//Set T0 time constant, timing 200us,
TH0=56;
TL0=56;
//Set T1 time constant, count 2500
TH1=(65536-2500)/256;
TL1=(65536-2500)%256;
//Start
TR0=1;
TR1=1;
while(1)
;
}
//Call this function every 200us,
void t0fun() interrupt 1
{
out=~out;
}
// When T1 reaches 2500, call this function
void t1fun() interrupt 3
{
P2=~P2;
//Set T1 time constant, count 2500
TH1=(65536-2500)/256;
TL1=(65536-2500)%256;
}
Previous article:C51: INT0
Next article:LCD:1602 display program
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Let’s talk about the “Three Musketeers” of radar in autonomous driving
- Why software-defined vehicles transform cars from tools into living spaces
- Matter Development Guide (V): Firmware Compilation and Burning
- 4. "Wanli" Raspberry Pi car - C++ learning (compile and run, use geany)
- Fitness and gaming equipment
- 【Review SGP40】-SGP40 test
- Does anyone know where to buy Hirose GT43 series connectors?
- Steps to create a register-based STM32 project in Keil5
- What is a Level 2 or Level 3 charger?
- Thank you for being there, thank you gift activity summary
- IAR download error
- 2019 National TI Sponsored Board Video Tutorials