|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Limiting PWM in pbasic
Posted by Matt Leese at 2/11/2001 1:59 PM EST
Other on team #73, Tigerbolt, from Edison Technical HS and Alstom & Fiber Technologies & RIT. In Reply to: Limiting PWM in pbasic Posted by Alan Federman on 2/11/2001 9:59 AM EST: Well, you need to remember that PBasic doesn't support floating point numbers. It only does integer math so multiplying times .25 (if it even compiles) won't ever do what you want. Dividing by 4 (or better yet, right shifting two places) will work. This however just scales down the output value. By using a MAX and MIN you put a fixed limit and the slope of the input is the same. When you scale down you change the slope of the data. When scaling, be careful with being greater than 127 or less than 127 as PBasic also doesn't support negative numbers so that will definatley give you bad data. So for stricked limiting of values MAX and MIN is better but if you want to slow down the robot totally, scaling works better. Matt |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pwm 13-15 | wayne 05 | Programming | 2 | 04-10-2003 12:08 |
| PWM and burning out motors | patrickrd | Technical Discussion | 7 | 19-06-2003 15:30 |
| Obscure PBASIC for RoboEmu | rbayer | Programming | 1 | 28-03-2003 23:57 |
| PBASIC access to 1 pin only | diego25 | Programming | 13 | 21-01-2002 10:55 |
| Building a control system | Katie Reynolds | Technical Discussion | 3 | 16-11-2001 09:34 |