MDSMC driving 2 motors at the same time

I’m fairly new at this and I can’t seem to get the MDSMC code. I am using a BS2 and can use the sample code in the back of the user manual to drive one motor as advertised but how do you establish a code that will drive both at the same time. It says byte 3 has has three parts, but do you write direction and motor number in binary and convert or what. Please give an example program for driving 2 motors

almost there,
Vince Anthony


Each command to the motor controller will affect one motor. Therefore, to turn on both motors, you will need to send two commands.

Typically, you would use four different values for byte 3:

0: motor 0 reverse
1: motor 0 forward
2: motor 1 reverse
3: motor 1 forward

In your program, you would make constants for these values at the top of your program:

m0rev  con  0
m0fwd  con  1
m1rev  con  2
m1fwd  con  3

Then, to make both motors go forward at the top speed of 127, you would use these two lines:

serout <serial pin>, 84, [$80, 0, m0fwd, 127]
serout <serial pin>, 84, [$80, 0, m1fwd, 127]

Let me know if you have any other questions.

- Jan