??? 08/14/05 02:25 Read: times |
#99361 - Some debugging is required Responding to: ???'s previous message |
You tell us the code is not working. This is only a small piece of code - if you have trouble debugging this small problem, how are you going to cope with a larger problem? I would suggest you get a pencil and paper and pretend your the processor. Make a column for each of your variables. Write the initial values. Then step through your code mentally, when a variable is modified, write down its value in its column. After a few steps you'll figure out where you're going wrong. I would suggest the initial values are not 50,000! There are many ways of doing pwm. Here is another: timer interrupt: { static unsigned int pwm_count = 0; pwm_count++; if (pwm_count > MAX_COUNT) pwm_count = 0; if (pwm_count >= servo1) PULSE =1; else PULSE = 0; } |