|
Programming with solder...
Posted by Joe Johnson.   [PICTURE: SAME | NEW | HELP]
Engineer on team #47, Chief Delphi, from Pontiac Central High School and Delphi Automotive Systems.
Posted on 2/3/2000 4:46 AM MST
In Reply to: Re: programming posted by Jerry Eckert on 2/2/2000 10:22 PM MST:
OR...
You could just reverse the wires going from the Victor to the motor.
Depends on what you want to do. If you want to see code examples that is one thing. If you really just want to reverse the direction of the motor, flipping the wires is easy too.
Joe J.
P.S. You MAY want to put a few more bits of code in the example given in the message by Jerry Eckert, depending on how paranoid you are about problems with PBasic's 16 bit unsigned math.
I would perhaps write it like this:
pwm1 = 254 - (pwm1 max 254)
This will prevent pwm1 from going wacko if it ever happens to be set to 255 going into the conversion. Also, while I am at it, do NOT do this:
pwm1 = (254 - pwm1) min 0
This will not work as desired. In PBasic, NOTHING is less than 0 so the expression 'XXX min 0' ALWAYS returns XXX. Pbasic has some strange ideas when it comes to math...
__________________
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.
|