bs2p40 problem with auxio and mainio commands
Dear Mr. / Mrs.
I have the professional experiment board (bs2p40pins) and I have connected 2 stepper motors on it.
I am trying to use the pins P4 P5 P6 P7 for the first stepper motor and X4 X5 X6 X7 for the other.
I use the commands MAINIO and AUXIO to separate the two motors'
The problem is that they refuse to work separately and work only together.
below is the code:
IF IN0=1 THEN
AUXIO
Phase VAR OUTB
idx VAR Byte
stpIdx VAR Nib
stpDelay VAR Byte
Steps DATA %0011, %0110, %1100, %1001
Setup:
DIRB = %1111
stpDelay = 15
Main:
FOR idx = 1 TO 48
GOSUB Step_Fwd
NEXT
PAUSE 500
FOR idx = 1 TO 48
GOSUB Step_Rev
NEXT
PAUSE 500
GOTO Main
END
Step_Fwd:
stpIdx = stpIdx + 1 // 4
GOTO Do_Step
Step_Rev:
stpIdx = stpIdx + 3 // 4
GOTO Do_Step
Do_Step:
READ (Steps + stpIdx), Phase
PAUSE stpDelay
RETURN
ELSEIF IN1=1 THEN
MAINIO
Phase1 VAR OUTB
idx1 VAR Byte
stpIdx1 VAR Nib
stpDelay1 VAR Byte
Steps1 DATA %0011, %0110, %1100, %1001
Setup1:
DIRB = %1111
stpDelay1 = 15
Main1:
FOR idx1 = 1 TO 48
GOSUB Step_Fwd1
NEXT
PAUSE 500
FOR idx1 = 1 TO 48
GOSUB Step_Rev1
NEXT
PAUSE 500
GOTO Main1
END
Step_Fwd1:
stpIdx1 = stpIdx1 + 1 // 4
GOTO Do_Step1
Step_Rev1:
stpIdx1 = stpIdx1 + 3 // 4
GOTO Do_Step1
Do_Step1:
READ (Steps1 + stpIdx1), Phase1
PAUSE stpDelay1
RETURN
ENDIF
I will appreciate if you could help me with this problem .
Thanks
john![tongue.gif](http://forums.parallax.com/images/smilies/tongue.gif)
I have the professional experiment board (bs2p40pins) and I have connected 2 stepper motors on it.
I am trying to use the pins P4 P5 P6 P7 for the first stepper motor and X4 X5 X6 X7 for the other.
I use the commands MAINIO and AUXIO to separate the two motors'
The problem is that they refuse to work separately and work only together.
below is the code:
IF IN0=1 THEN
AUXIO
Phase VAR OUTB
idx VAR Byte
stpIdx VAR Nib
stpDelay VAR Byte
Steps DATA %0011, %0110, %1100, %1001
Setup:
DIRB = %1111
stpDelay = 15
Main:
FOR idx = 1 TO 48
GOSUB Step_Fwd
NEXT
PAUSE 500
FOR idx = 1 TO 48
GOSUB Step_Rev
NEXT
PAUSE 500
GOTO Main
END
Step_Fwd:
stpIdx = stpIdx + 1 // 4
GOTO Do_Step
Step_Rev:
stpIdx = stpIdx + 3 // 4
GOTO Do_Step
Do_Step:
READ (Steps + stpIdx), Phase
PAUSE stpDelay
RETURN
ELSEIF IN1=1 THEN
MAINIO
Phase1 VAR OUTB
idx1 VAR Byte
stpIdx1 VAR Nib
stpDelay1 VAR Byte
Steps1 DATA %0011, %0110, %1100, %1001
Setup1:
DIRB = %1111
stpDelay1 = 15
Main1:
FOR idx1 = 1 TO 48
GOSUB Step_Fwd1
NEXT
PAUSE 500
FOR idx1 = 1 TO 48
GOSUB Step_Rev1
NEXT
PAUSE 500
GOTO Main1
END
Step_Fwd1:
stpIdx1 = stpIdx1 + 1 // 4
GOTO Do_Step1
Step_Rev1:
stpIdx1 = stpIdx1 + 3 // 4
GOTO Do_Step1
Do_Step1:
READ (Steps1 + stpIdx1), Phase1
PAUSE stpDelay1
RETURN
ENDIF
I will appreciate if you could help me with this problem .
Thanks
john
![tongue.gif](http://forums.parallax.com/images/smilies/tongue.gif)
![tongue.gif](http://forums.parallax.com/images/smilies/tongue.gif)
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
It will be very helpful if you could tell me where i can find information to read about my problem.
thanks again for your help.
Edit: Your duplicate message has been removed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
Post Edited (Chris Savage (Parallax)) : 1/14/2009 4:06:16 PM GMT