Stepper coil sequences

ZOR

Senior Member
Being back on steppers after a while, I am trying to make a reference list of stepper coil switching sequences for 08M2 and 18M2 use as I still cannot work out what the table means in manual 3 in relationship to Picaxe pin order/designation. I think

Can someone please check my list so far is correct. All work okay with exception to the 18M2 using B.4-B.7. I have LED'S on the 18M2 output and B.6 does not come on. Sorry to admit ignorance but I don't want to carry on with trial and error. The double bank of syntax lines refer to motor running forward/reverse. It also leave out Let ..... and pauses.

Thanks

Code:
'Stepper coil sequence - 18M2 Using B.0-B.3

%00000101 '  B.0/B.2
%00001001 '  B.0/B.3
%00001010 '  B.1/B.3
%00000110 '  B.1/B.2
------------------------------------
%00000110 '  B.1/B.2
%00001010 '  B.1/B.3
%00001001 '  B.0/B.3
%00000101 '  B.0/B.2

'Stepper coil sequence - 18M2 Using B.4-B.7

%01010000 '  B.4/B.6
%10010000 '  B.4/B.7 
%10100000 '  B.5/B.7
%01100000 '  B.5/B.6
------------------------------------
%01100000 '  B.5/B.6
%10100000 '  B.5/B.7
%10010000 '  B.4/B.7
%01010000 '  B.4/B.6

===========================

'Stepper coil sequence -  08M2 Using C.0-C.4

%00010010 '  C.1/C.4
%00010001 '  C.0/C.4
%00000101 '  C.0/C.2
%00000110 '  C.1/C.2
---------------------------------------	
%00000110 '  C.1/C.2
%00000101 '  C.0/C.2
%00010001 '  C.0/C.4
%00010010 '  C.1/C.4
EDIT: Just found my 18M2 output on B.6 is dead, reason for B.4-B.7 not working properly. Appreciate a check on my list, thanks
 
Last edited:

ZOR

Senior Member
Can anyone add help to my #1. The coil energising order table means nothing to me if I have any Picaxe pins in an order different to , i.e B.0,B.1,B.2,B.3, what if I have pins more easily laid out on PCB as B.3, B.1, B.4, B.1 or any other mixture of output pins.

I am trying as said in #1, to make a reference list of the syntax used for different Picaxes. I would rather know exactly how things relate for different ports/picaxe instead of wasting time looking back paperwork. It would also be good to know if the lines of code I have in #1, in case an undetectable coil order exists.

Hope once and for all to understand this subject. I am using both Bipolar and Unipolar motors. Hope someone else might be having the same problem.
 

hippy

Technical Support
Staff member
There won't be a definitive list because anyone could wire up the output pins however they feel.

But one does know that the way steppers work is by cycling two bits through the coil in a particular order -

Code:
abcd
1100
0110
0011
1001
1100
And for the other direction -

Code:
abcd
1100
1001
0011
0110
1100
What you then have to do is work out which of your stepper motor coils are 'a', 'b', 'c' and 'd' and then note which I/O pins those are connected to.

Then you could define your states as symbols, for example -

Code:
;             76543210
;              a  cd b   abcd
symbol CW0 = %01000001 ; 1100
symbol CW1 = %00001001 ; 0110
symbol CW2 = %00001100 ; 0011
symbol CW3 = %01000100 ; 1001
 

ZOR

Senior Member
Thanks hippy. However why does manual 3 show this coil order?

COIL ORDER.jpg

I am still in the dark, if I have a stepper motor with a plug on, and a mating socket on the PCB, and my circuit tracks prevent a logical order of output pins going to coils, how do I sort that out. Example being the socket has coils A,B,C,D in order but my port pins goto in the order of B.5, B.6, B.4, b.7. Ok may not happen but could, then how does that get sorted including my code for running the motor. Sorry to be such a ........ Thanks
 

hippy

Technical Support
Staff member
a = Coil 3
b = Coil 1
c = Coil 4
d = Coil 2

I think the problem is in trying to find a logical order for both the software and hardware, want B.0 to coil 1, B.1 to coil 2, B.2 to coil 3, B.3 to coil 4, then want to move the two bits B.0+B.1, B.1+B.2, B.2+B.3, B.3+B.0.

That is not always possible to achieve; there is likely always something in the mix which prevents that.
 

ZOR

Senior Member
Thanks hippy, sorry to have put you through the loop and back. So I will have to make sure that ports are in order to coils. Regards
 
Top