void main(void)
{
TMR0IF=0; //Clear TMR0 interrupt flag
TMR0=255; //Set the interrupt initial value to 255
unsigned int k = 1;
unsigned int TIMER0 = 0,TIMER1 = 0,TIMER2 = 0;
unsigned char Flag_1 = 1;
unsigned char Flag_2 = 1;
unsigned char Flag_3 = 1;
Pin_Init();
Answ_Out = 0;
Light1 = 0;
Light2 = 0;
Light3 = 0;
Light4 = 0;
while(1)
{
if( (TMR0IF == 1) && (Flag_1 ==1) ) // Enable timer overflow interrupt
{
TIMER0++; //Counter+1
TMR0IF = 0; // Timer overflow flag cleared
TMR0 = 255;
}
if(TIMER0 == k ) //If the counter value is equal to the set value
{
Light4 = 1; //light off
}
if(TIMER0 == 100 ) //Counter increases to 90
{
Light4 = 0; //Light on
TIMER0 = 0;
k++; //Set value initialization
}
if( k == 99 )
{
Light4 = 0;
k =1;
Flag_3 = 1;
Flag_1 = 0;
}
if( (TMR0IF == 1) && (Flag_2 ==1) ) // Enable timer overflow interrupt
{
TIMER1++; //Counter+1
TMR0IF = 0; // Timer overflow flag cleared
TMR0 = 255;
}
if( TIMER1 == 40040)
{
Light4 = 1;
TIMER1 = 0;
Flag_1 = 1;
Flag_2 = 0;
}
if( (TMR0IF == 1) && (Flag_3 ==1) ) // Enable timer overflow interrupt
{
TIMER2++; //Counter+1
TMR0IF = 0; // Timer overflow flag cleared
TMR0 = 255;
}
if(TIMER2 == k ) //If the counter value is equal to the set value
{
Light4 = 0; //Light on
}
if(TIMER2 == 100 ) //Counter increases to 90
{
Light4 = 1; //light off
TIMER2 = 0;
k++; //Set value initialization
}
if( k == 99 )
{
Light4 = 0;
k =1;
Flag_2 = 1;
Flag_3 = 0;
}
}
}
Previous article:PIC multi-channel ADC interrupt mode
Next article:PIC HEX file format analysis
- 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
- CGD and Qorvo to jointly revolutionize motor control solutions
- CGD and Qorvo to jointly revolutionize motor control solutions
- Keysight Technologies FieldFox handheld analyzer with VDI spread spectrum module to achieve millimeter wave analysis function
- Infineon's PASCO2V15 XENSIV PAS CO2 5V Sensor Now Available at Mouser for Accurate CO2 Level Measurement
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- A new chapter in Great Wall Motors R&D: solid-state battery technology leads the future
- Naxin Micro provides full-scenario GaN driver IC solutions
- Interpreting Huawei’s new solid-state battery patent, will it challenge CATL in 2030?
- Are pure electric/plug-in hybrid vehicles going crazy? A Chinese company has launched the world's first -40℃ dischargeable hybrid battery that is not afraid of cold
- Which mooncake filling is the most delicious? EEWorld has selected several for you, come and redeem them!
- Xiaobai asks for help with Xilinx programming issues
- DSP CMD file MEMORY PAGE
- Comparison of network isochronous line settings after AD18 and previous versions
- 99iot AFW127PI Wi-Fi Module Specification
- MSP430F5438 interrupt problem
- 【Recruitment】Full-time and part-time RF engineers
- FPGA several download methods.doc
- When posting, when inviting others to participate, can you directly write the names of multiple people and submit them together, which can save time
- 2020 Python Developer Survey Results