View Single Post
  #2   Spotlight this post!  
Unread 24-06-2002, 00:38
archiver archiver is offline
Forum Archival System
#0047 (ChiefDelphi)
 
Join Date: May 2001
Location: Pontiac, MI
Posts: 21,214
archiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond reputearchiver has a reputation beyond repute
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


__________________
This message was archived from an earlier forum system. Some information may have been left out. Start new discussion in the current forums, and refer back to these threads when necessary.