View Single Post
  #3   Spotlight this post!  
Unread 16-01-2002, 20:35
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,642
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Why a PWM value should NEVER be 255...

This is also why you should always limit your PWM values to 254 -- NEVER allow them to be 255.

If you look at the output order, there is always a PWM value output between things that could possibly be a value of 255 (for instance you may want all relays ON, in this case relayA may be all 1's which is $FF or 255. If this was next to another thing, say relayB that could also be 255, the master CPU would think, "A HA, This is the start of the data stream" But, Innovation First cleverly put a PWM value in between RelayA and RelayB. So, the only way to make a "255, 255" sequience is to foolishly allow the PWM value to equal 255.

This problem can cause very subtle errors. MOST of the time everything is right as rain, then BOOM! Thunder and lighting! your code crashes.

Do yourself a favor, make sure you get good at limiting the values of your PWM outputs to 0-254.

Joe J.