steve24rdg
Member
hi to all
I would like some help please on how I can shift the phase of signals to control a stepper motor in full step 2 phase mode.
no matter what i try the 2 phases never seem to be in step with a 90 deg phase shift.
see attached pic
my code is
dirs = %00010111
symbol step1 = %00010100
symbol step2 = %00000110
symbol step3 = %00000011
symbol step4 = %00010001
symbol stepcount = b0
symbol delay =5
main:
do
if stepcount = 0 then main1
if stepcount = 1 then main2
if stepcount = 2 then main3
if stepcount = 3 then main4
end
loop
main1:
pinsc = step1
pause delay
inc stepcount
goto main
main2:
pinsc = step2
pause delay
inc stepcount
goto main
main3:
pinsc = step3
pause delay
inc stepcount
goto main
main4:
pinsc = step4
pause delay
stepcount = 0
goto main
im still quite a noob at all this and i am sure many of you will look at this and think of at least a dozen ways to make it more simple.
but i am learning all the time which is the main thing.
thanks for your help
steve
I would like some help please on how I can shift the phase of signals to control a stepper motor in full step 2 phase mode.
no matter what i try the 2 phases never seem to be in step with a 90 deg phase shift.
see attached pic
my code is
dirs = %00010111
symbol step1 = %00010100
symbol step2 = %00000110
symbol step3 = %00000011
symbol step4 = %00010001
symbol stepcount = b0
symbol delay =5
main:
do
if stepcount = 0 then main1
if stepcount = 1 then main2
if stepcount = 2 then main3
if stepcount = 3 then main4
end
loop
main1:
pinsc = step1
pause delay
inc stepcount
goto main
main2:
pinsc = step2
pause delay
inc stepcount
goto main
main3:
pinsc = step3
pause delay
inc stepcount
goto main
main4:
pinsc = step4
pause delay
stepcount = 0
goto main
im still quite a noob at all this and i am sure many of you will look at this and think of at least a dozen ways to make it more simple.
but i am learning all the time which is the main thing.
thanks for your help
steve