CodePudding user response:
The building Lord chosen breakpoint location is wrong, at time++ breakpoints, program timing can enter the interrupt handler, 0 TH0 must be 0 x00 at this time,In the position of the PWM PWM==0 or 1 add breakpoints can view TH0 initial value,
CodePudding user response:
Upstairs positive solution, TH0 added to 0 XFF interrupt, but you the simulation into the interrupt 1, TH0 is 0, your code can meet your requirements, while writing is not good,Such as timing, initial value instead of a macro definition of time if you don't need to count, can use type bool, then
Time=~ time;
{if (time)
} else {
}
If it's not a bool type,
If (time & amp; {0 x01)
} else {
}
[/code]
8-bit, try not to use 16 digits, not hardware, method, as far as possible need not, method,