| Russell Bull 08/13/05 21:25 Read: 363 times Melbourne Australia |
#99361 - Some debugging is required Responding to: Ade Popoola'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; } |
| Topic | Author | Date |
| Pulse Width Modulation Code..giving back | Adam Klaum | 07/20/05 00:55 |
| Something else weird | Adam Klaum | 07/20/05 01:12 |
| Not Weird | Robert Henneke | 07/20/05 01:23 |
| Thanks, good to know. | Adam Klaum | 07/20/05 01:31 |
| hexmap, AT89C4051 | Jan Waclawek | 07/20/05 03:39 |
| To be more precise... | Andy Neil | 07/20/05 03:46 |
| Delay ? | Slobodan Mandaric | 07/20/05 03:49 |
| Other suggestions? | Adam Klaum | 07/20/05 11:25 |
| maybe | Erik Malund | 07/20/05 11:46 |
| Timer ISR Pretty Long | Marshall Brown | 07/20/05 20:14 |
| Or simpler ... | Slobodan Mandaric | 07/21/05 01:25 |
| not really | Erik Malund | 07/21/05 09:50 |
| Ridicule | Andy Neil | 07/20/05 04:02 |
| this may work!! try out... | Vianyak M Kolagi | 07/25/05 01:12 |
| Wrong ! | Slobodan Mandaric | 07/25/05 08:07 |
| my loop for >256 itterations | Oleg Sergeev | 07/25/05 08:24 |
| That's nice, but still ... | Slobodan Mandaric | 07/25/05 08:41 |
| no | Oleg Sergeev | 07/25/05 09:44 |
| Using port read backs | Russell Bull | 07/25/05 07:05 |
| Thanks... and some basic timer concepts | Adam Klaum | 07/25/05 13:03 |
| some answers | Erik Malund | 07/25/05 13:09 |
| timekeeping | Jan Waclawek | 07/25/05 16:12 |
| plerase quote everything | Erik Malund | 07/25/05 16:27 |
| bloated ISR? | Jan Waclawek | 07/26/05 04:32 |
| This is a nice little bug that show up | Erik Malund | 07/26/05 07:15 |
| Yes but | Steve M. Taylor | 07/26/05 07:25 |
| experience... or .... | Jan Waclawek | 07/26/05 08:07 |
| What is Erik's 8052 University? | Adam Klaum | 07/26/05 10:27 |
| http://www.8052.com/forum/read.phtml?id= | Erik Malund | 07/26/05 10:49 |
| well | Benjamin Damet | 07/26/05 07:30 |
| Ah but... | Steve M. Taylor | 07/26/05 07:32 |
| Is that a valid design criteria. Should | Erik Malund | 07/26/05 07:37 |
| use it later | Jan Waclawek | 07/26/05 08:06 |
| based on your post above that includes y | Erik Malund | 07/26/05 08:14 |
| Try it! (Curious myself) :-) | Jan Waclawek | 07/26/05 08:17 |
| Still a bit confused | Adam Klaum | 07/26/05 10:25 |
| not quite complete | Erik Malund | 07/26/05 10:47 |
| 256 cycles | Jan Waclawek | 07/26/05 11:41 |
| youn are absolutotally missing the point | Erik Malund | 07/26/05 12:13 |
| Not a bug at all! | Jan Waclawek | 07/26/05 14:53 |
| which will not happen | Erik Malund | 07/26/05 15:15 |
| who's afraid of the wolf... | Jan Waclawek | 07/26/05 16:19 |
| crying wolf once bitten | Erik Malund | 07/26/05 16:27 |
| you restriction... | Jan Waclawek | 07/26/05 16:53 |
| Cynicism | Steve M. Taylor | 07/27/05 04:18 |
| more widespread among Pascal and C users | Erik Malund | 07/27/05 07:25 |
| Calculating machine cycles | Adam Klaum | 07/27/05 19:28 |
| Counting machine cycles | Russell Bull | 07/27/05 19:47 |
| Use Keil or JSIM tools | Charles Bannister | 07/27/05 23:32 |
| the point | Erik Malund | 07/28/05 06:54 |
| PWM with 8051 | Ade Popoola | 08/13/05 17:47 |
Some debugging is required | Russell Bull | 08/13/05 21:25 |
| NOTICE: Message(s) moved | Craig Steiner | 08/01/05 08:46 |



