#include
sbit LED_1 = P1^1;
void initT0(void)
{
TMOD = 0x01; //Select T0 working mode 1, 16-bit timer/counter, TR0 direct switch
TH0 = 0xFC;
TL0 = 0x18; //1ms
EA = 1; //Open the general interrupt
ET0 = 1; //Open T0 interrupt
TR0 = 1; //Open timer T0
}
//T0 interrupt service routine 1
void Timer0Int(void) interrupt 1
{
TH0 = 0xFC;
TL0 = 0x18;
LED_1 = ~LED_1;
}
int main(void)
{
initT0();
while(1)
{
}
}
Previous article:51 timer uses T0 and T1 to control the generation of accurate PWM waveform routine
Next article:51 counter counting example
- Popular Resources
- Popular amplifiers
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
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Some questions about air conditioning automatic control system
- Sensorless FOC commutation frequency 700HZ
- Added performance test for STM32L432
- ADI's smoke detector integrated solution based on ADPD188BI has started the registration for the prize live broadcast~
- Prize-winning live broadcast: TI chip technology is helping motor development in progress!
- C2000 MCU DesignDRIVE Solutions for Industrial Motor Drives
- New predictions for cloud computing in 2019
- Typical applications of Zigbee technology in street light control systems
- Bluetooth BLE - BlueNRG2 VTimer
- Celebrate National Day and wish our motherland a happy 70th birthday!