View Single Post
  #7   Spotlight this post!  
Unread 05-08-2005, 13:49
Morenoh149
 
Posts: n/a
Re: Help with limit mix

Quote:
Originally Posted by GW (Greg) Ross
OK. I forgot about the 8 bit quirk. Adding the 2000 bias does circumvent this trap, but it's an awfully kludgy way to do it. I assert the following would be clearer: (Assuming that all the definitions remain eight bits each.)
Code:
pwm01 = pwm03 = Limit_Mix((int)PWM_in1 + PWM_in2 - 127); /* LEFT WHEELS */
pwm02 = pwm04 = Limit_Mix((int)PWM_in2 - PWM_in1 + 127); /* RIGHT WHEELS */
so what does the (int) do?
does it make the PIC treat all variables (PWM_in2 & PWM_in1) in the Parenthesis like an int instead of a char ?