Log in

View Full Version : Is the maximum PWM value 254 or 255?


markulrich
24-06-2008, 17:28
My team has always used 255 as the cut-off point for PWM values (otherwise things loop over), but whenever I look at example code I see others using 254. Why is this? Are the victors pre-calibrated to use 254? Do you get any more power by using 255?

Joe G.
24-06-2008, 17:44
I've always used 255.
the difference should be absolutely negligibly though.

Madison
24-06-2008, 18:05
The IFI system was designed to reset if it saw some series of values of 255, as I recall. Someone wiser than I in these matters will elaborate.

tennispro9911
24-06-2008, 18:09
If 127 is truely exact middle then 254 should be max. In reality, I don't know. Our team has used both values at different points in time with no noticable differences.

usbcd36
24-06-2008, 18:42
I've always calculated the PWM value as being 127±127, so I say 254.

JimWright949
24-06-2008, 18:44
If memory serves, pre-2004 RCs would disable the PWM port if it saw 255. 2004 up to now can use the full 0-255 range. A signed 8 bit number goes from -128 to 127 by the way.

-Jim

Alex.Norton
24-06-2008, 18:49
Since everything in a computer is measured in binary. In this it is a char there fore is 8 bits so can hold 2^8 possibilities, or 256, however as with everything in programing start with zero so it holds any number from 0 to 255.

tseres
24-06-2008, 18:59
255 is max, as an 8bit number is 256, therefore 0-255. the victors also have a deadband of +/- 5 values, so anything from 122-132 should be neutral, but i'll still do 127 just to be sure ;)

Alan Anderson
24-06-2008, 20:02
The IFI control system will not send a pwm value of 255. If you try to set a 255, it turns into a 254.

The historical reason for this is the design of the data packets between the OI and RC. Two 255s in a row flag the start of a packet.

markulrich
24-06-2008, 20:08
Thanks Alan! That explains a lot; using 254 is also nice because then 127 is the true middle.

Joe Ross
24-06-2008, 22:47
There isn't any difference between 254 and 255 when used with a victor speed controller, in fact, there isn't any difference between 255 and 233. See this post on the IFI forum: http://www.ifirobotics.com/forum/viewtopic.php?t=317

Also notice that at the default calibration, the real center is 132.

markulrich
25-06-2008, 14:17
Look at the attached chart. The PWM input is x-axis, and y-axis is estimated output (%) based on these figured from IFI:

VAULE STATE LED STATUS Pulse Width
0 – 41 Full Reverse RED 0.856 – 1.06 ms
42 – 125 Reverse OFF 1.07 – 1.48 ms
126 – 139 Neutral YELLOW 1.49 – 1.55 ms
140 – 230 Forward OFF 1.56 – 2.00 ms
231 – 254 Full Forward GREEN 2.01 – 2.12 ms

The other, darker line is the target output based on a cubic function with dead bands at the beginning, middle, and end. I am working on creating a look-up table to insert into code that could accomplish this. Any suggestions are appreciated.

craigcd
25-06-2008, 16:15
Are the PWM values valid for the new operating system?

markulrich
25-06-2008, 17:03
I think these values are valid for the new operating system because I believe that the new operating system will be using the same victors from IFI.

Fletch1373
02-07-2008, 01:50
from what I've read about the new control system(and anyone is free to correct me), it will be using the same Victors as previous years and therefore the 8 bit 0-255 range would still be valid

I apologize if I just restated everything that was already said... I just thought I'd get my 2 cents in