Home > other >  A picture is not clear on the retransmission, big solutions
A picture is not clear on the retransmission, big solutions

Time:11-25

This is 51 single chip microcomputer program, the name PWM is random, itself has no PWM hardware, I this application purpose is by changing the timer to control the duty ratio of the initial conditions, but in the program the timer TH0 has no matter how many times is running at 0 x00 address, how to modify the program

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,
  • Related