View Single Post
  #14   Spotlight this post!  
Unread 14-01-2008, 01:37
comphappy comphappy is offline
Registered User
AKA: Brennan Ashton
FRC #2605 (A2D_16)
Team Role: Leadership
 
Join Date: Jan 2008
Rookie Year: 2008
Location: Bellingham, WA
Posts: 157
comphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to beholdcomphappy is a splendid one to behold
Send a message via AIM to comphappy
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by billbo911 View Post
I'm not sure I am following what the question is. If you have a PWM value that is going to be only one of two states, 0 or 255, then just test for one state. For example:

Code:
if (pwm03 > 127)
    {
      accumulator ++;
    }
else
    {
     accumulator --;
    }
I chose 127 just for simplicity.

Just as easily, you could test for the actual value.

Code:
if (pwm03 == 255)
    {
      accumulator ++;
    }
else
    {
     accumulator --;
    }
I was attempting to understand what the PHASE B was, i now know, and was just expressing how i was going to do it with out it in my specialized case. That code you wrote is exactly what i had described, and what has been in our code for a while now.