Shop OBEX P1 Docs P2 Docs Learn Events
bs2p40 problem with auxio and mainio commands — Parallax Forums

bs2p40 problem with auxio and mainio commands

iolasiolas Posts: 14
edited 2009-01-14 18:14 in BASIC Stamp
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.giftongue.gif

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-12 20:37
    Please note that, due to the mapping of the pins of a 24-pin BASIC Stamp compared to a 40-pin BASIC Stamp that when the 40-pin BASIC Stamp is plugged in, P0 through P7 are normal, however on the BASIC Stamp socket P8 through P15 will be the AUX pins. Please refer to the documentation for how the remaining pins are mapped and share a connection with the SX I/O pins. I hope this helps. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • iolasiolas Posts: 14
    edited 2009-01-13 21:50
    thanks but i didn't understand what you really advise me.
    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.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-01-14 15:58
    The documentation for the PDB shows where the pins connect on a BS2p40, which is different from the connections of a 24-pin BASIC Stamp.

    Edit: Your duplicate message has been removed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering


    Post Edited (Chris Savage (Parallax)) : 1/14/2009 4:06:16 PM GMT
  • iolasiolas Posts: 14
    edited 2009-01-14 18:14
    Thanks.....
Sign In or Register to comment.