Help with BX24 Code

I’ve been trying to get my BasicX BX24 to communicate with the Micro Dual Serial Motor Controller with no luck. I’m hoping someone can help point out my error because I am stuck at this point. Here’s the code:

Option Explicit
Dim MotorStart as byte
Dim MIdent as byte
Dim MDir as byte
Dim MSpeed as byte
Dim ComIn(1 to 4) as byte
Dim ComOut(1 to 4) as byte
Public Sub Main()
MotorStart=80
MIdent=0
MDir=2
MSpeed=127

Call Putpin(6, 0)
Delay (1.00)
Call Putpin(6, 1)
Delay (1.00)
Call PutPin(26, 0)
Call Delay(0.07)
Call PutPin(26, 1)
Call DefineCom3(7, 5, bx0000_1000)
Call OpenQueue(ComIn, 30)
Call OpenQueue(ComOut, 30)
Call OpenCom(3,9600,ComIn,ComOut)
Do
Call PutQueue(ComOut, MotorStart, 1)
Call PutQueue(ComOut, MIdent, 1)
Call PutQueue(ComOut, MDir, 1)
Call PutQueue(ComOut, MSpeed, 1)
Delay (10.00)
MSpeed=0
Call ClearQueue(ComOut)
Call PutQueue(ComOut, MotorStart, 1)
Call PutQueue(ComOut, MIdent, 1)
Call PutQueue(ComOut, MDir, 1)
Call PutQueue(ComOut, MSpeed, 1)
Delay (10.00)
Call PutPin(25, 0)
Call Delay(0.07)
Call PutPin(25, 1)
Loop

End Sub

What I’ve found is that the controller seems to reset as soon as I call DefineCom3. I am totally stuck here and any help would be greatly appreciated!

Hello,

You should provide better information if you want help. You say the call to DefineCom3 is where you see a problem, but you don’t explain the problem at all. Which controller is resetting? How can you tell? What is happening before that line? Also, especially given that you ares suspecting DefineCom3 of being the problem, you should provide information about it (e.g. provide a link to some documentation–don’t expect someone else to go searching for it).

- Jan