Assignment operation in BS2.....
Archiver
Posts: 46,084
Hi,
I have question, might sound silly though. I am using an analog
joystick to drive two dc motors using an LTC1298, BS2 & an MMC.
In the LTC program, the input toggles between 0 & 1 (oddSign = 0 to
1 , where oddSign is a VAR) to give out channel0 & channel1
respectively on the Debug screen. Is there anyway I can assign
(oddSign = 0) to a VAR say CH0 & (oddSign = 1) to another VAR say
CH1 so that my algorithm would be something like this:
If CH0>*** & CH1<*** THEN PWM_REG1 = XXX & PWM_REG2 = XXX
for FORWARD motion of motors & so on for other directions..
When I directly used:
If (oddSign = 0)>*** & (oddSign = 1)<*** THEN PWM_REG1 = XXX &
PWM_REG2 = XXX
there was no effect on my program. It appeared to me like the
condition was just skipped and the subsequent portion of my program
was executed.
I would also like to know if you can help me in the following
matters (if possible share any sample codes):
1) Driving 2 motors using an analog joystick with an LTC1298, a BS2
& an MMC in between.
2) Driving 3 servos using the same analog joystick, LTC 1298, BS2 &
an SSC in between.
Please let me know.
Thank you all in advance.
Sashi.
I have question, might sound silly though. I am using an analog
joystick to drive two dc motors using an LTC1298, BS2 & an MMC.
In the LTC program, the input toggles between 0 & 1 (oddSign = 0 to
1 , where oddSign is a VAR) to give out channel0 & channel1
respectively on the Debug screen. Is there anyway I can assign
(oddSign = 0) to a VAR say CH0 & (oddSign = 1) to another VAR say
CH1 so that my algorithm would be something like this:
If CH0>*** & CH1<*** THEN PWM_REG1 = XXX & PWM_REG2 = XXX
for FORWARD motion of motors & so on for other directions..
When I directly used:
If (oddSign = 0)>*** & (oddSign = 1)<*** THEN PWM_REG1 = XXX &
PWM_REG2 = XXX
there was no effect on my program. It appeared to me like the
condition was just skipped and the subsequent portion of my program
was executed.
I would also like to know if you can help me in the following
matters (if possible share any sample codes):
1) Driving 2 motors using an analog joystick with an LTC1298, a BS2
& an MMC in between.
2) Driving 3 servos using the same analog joystick, LTC 1298, BS2 &
an SSC in between.
Please let me know.
Thank you all in advance.
Sashi.
Comments
I am a bit confused and don't know whether I got that right, but
could this be what you are looking for?
if oddSign = 1 goto pwm_2
PWM_REG1 = XXX
goto pwm_end
pwm_2:
PWM_REG2 = XXX
pwm_end:
Regards
Adrian