3 Steppers 1 BS2 Question??
First off I would like to say hello 2 everyone. I am just getting involved into microcontrollers and have built and coded a few Model train systems Assesory Decoders , Pir EBrake system and so on. Now i built a mini cnc machine and have used the parallax demo step code as a base . I do not plan on writing codes for g or any other stuff just bs2 straight to steppers. I am using 3 uln's 1 for each stepper and have set everything up based off of parallax's experiment 26 or whatever. I had no problem with 1 or even running dual. Note each motor will only run 1 at a time so I don't think I have power issues but who knows. Each stepper has its own voltage regulator and I am not using my stamps power at all....Excecpt to the array's....Now this code listed here is just a complete copy for more motors. Coils1 (OUTB) is the original and (OUTC) & (OUTD) I have added.....Here's where I get confused when you run this code it runs the first 2 perfect but when it gets to OUTD Im only getting power at· pin12 which is the first pin in OUTD...So why no power out of pin13,14,15.... To answer a couple questions I now I'm going to get asked....When I change the outputs to A,B,C it does the same thing even though I'm not using OUTD it will be like OUTC doesn't get anything on the last 3 pins in its group. I have verified that the wiring to steppers and stamp are correct and have run all 3 of these motors in different Dual setups but just can't tackle 3 for some reason. I am using LEDS to show me my steps on the board and can furnish a video of the code running. But I know once someone reads this you'll knoow what the problem is. I think I just don't know enough about writing code...I am making leaps and bounds every week though...Thanks for the help In advance.........Radridz3
P.S. this mini cnc is probably only going to make 1 certain pcb for me so once the codes done where goooooood....Im just going to use it to drill boards because im starting to look like popeye on 1 arm from holding the Dewalt for a thousand holes..>>..>.>>>>>.....
P.S. this mini cnc is probably only going to make 1 certain pcb for me so once the codes done where goooooood....Im just going to use it to drill boards because im starting to look like popeye on 1 arm from holding the Dewalt for a thousand holes..>>..>.>>>>>.....
' {$STAMP BS2}
' {$PBASIC 2.5}
' ------------------------------------------------------------------------------
' I/O Definitions
' ------------------------------------------------------------------------------
Coils1 VAR OUTB
Coils2 VAR OUTC
Coils3 VAR OUTD
' ------------------------------------------------------------------------------
' Constants
' ------------------------------------------------------------------------------
Scale1 CON $100
Unknown1 CON 5
StpsPerRev1 CON Unknown1
Scale2 CON $100
Unknown2 CON 25
StpsPerRev2 CON Unknown2
Scale3 CON $100
Unknown3 CON 50
StpsPerRev3 CON Unknown3
Scale4 CON $100
Unknown4 CON 100
StpsPerRev4 CON Unknown4
Scale5 CON $100
Unknown5 CON 200
StpsPerRev5 CON Unknown5
' ------------------------------------------------------------------------------
' Variables
' ------------------------------------------------------------------------------
speed VAR Word
idx VAR Byte
stpIdx VAR Byte
' ------------------------------------------------------------------------------
' EEPROM Data
' ------------------------------------------------------------------------------
Step1 DATA %1100
Step2 DATA %0110
Step3 DATA %0011
Step4 DATA %1001
' ------------------------------------------------------------------------------
' Initialization
' ------------------------------------------------------------------------------
Setup:
DIRB = %1111
speed = 1
DIRC = %1111
speed = 1
DIRD = $1111
speed = 1
' ------------------------------------------------------------------------------
' Program Code
' ------------------------------------------------------------------------------
Main:
FOR idx = 1 TO StpsPerRev5
GOSUB Step_Fwd1
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev4
GOSUB Step_Rev1
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev3
GOSUB Step_Fwd1
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev2
GOSUB Step_Rev1
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev1
GOSUB Step_Fwd1
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev5
GOSUB Step_Fwd2
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev4
GOSUB Step_Rev2
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev3
GOSUB Step_Fwd2
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev2
GOSUB Step_Rev2
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev1
GOSUB Step_Fwd2
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev5
GOSUB Step_Fwd3
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev4
GOSUB Step_Rev3
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev3
GOSUB Step_Fwd3
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev2
GOSUB Step_Rev3
NEXT
PAUSE 500
FOR idx = 1 TO StpsPerRev1
GOSUB Step_Fwd3
NEXT
PAUSE 500
GOTO Main:
' ------------------------------------------------------------------------------
' Subroutines
' ------------------------------------------------------------------------------
Step_Fwd1:
stpIdx = stpIdx + 1 // 4
READ (Step1 + stpIdx), Coils1
PAUSE speed
RETURN
Step_Rev1:
stpIdx = stpIdx + 3 // 4
READ (Step1 + stpIdx), Coils1
PAUSE speed
RETURN
Step_Fwd2:
stpIdx = stpIdx + 1 // 4
READ (Step1 + stpIdx), Coils2
PAUSE speed
RETURN
Step_Rev2:
stpIdx = stpIdx + 3 // 4
READ (Step1 + stpIdx), Coils2
PAUSE speed
RETURN
Step_Fwd3:
stpIdx = stpIdx + 1 // 4
READ (Step1 + stpIdx), Coils3
PAUSE speed
RETURN
Step_Rev3:
stpIdx = stpIdx + 3 // 4
READ (Step1 + stpIdx), Coils3
PAUSE speed
RETURN

Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Find the typo and you win!
Setup:
· DIRB = %1111
· DEBUG BIN16 ? DIRS
· speed = 1
· DIRC = %1111
· DEBUG BIN16 ? DIRS
· speed = 1
· DIRD = $1111
· speed = 1
· DEBUG BIN16 ? DIRS
· STOP