Stepper motor control board
by Ranjith | November 17th, 2008.Program 1:-
It is advisable to begin with easy program. So in this program we shall see minimal functionality. Only first two switches and first three LEDs will be used. When you press one switch the motor will start rotating in clockwise direction and stops when completes one revolution. Pressing second switch will do the same job but in anticlockwise direction. The speed will be 10 RPM fixed. Motor runs in single coil excitation mode. First LED indicates key press event. Second blinks when motor rotates clockwise and third blinks when motor rotates anticlockwise.
Org 00h
mov r0,#01h ; initileze key count
mov p1,#0ffh ; P1 as input port
lop: mov a,p1
cjne a,#0ffh,jmp
ajmp lop ; loop until any key
; is pressed
jmp: clr p0.0 ; indicates keypress
loop: rrc a
jnc num ; get key no.
inc r0
sjmp loop
num: acall dely ; key debounce delay
setb p0.0
cjne r0,#01h,nxt ; for 1st key
acall clkwise ; rotate motor
sjmp over ; clock wise
nxt: cjne r0,#02h,over ; for 2nd key
acall aclkwise ; rotate anticlock
over: mov p2,#00h ; restore initial
mov p1,#0ffh ; data and
mov r0,#01h
sjmp lop ; jump to loop again
clkwise:
mov r1,#32h ; load count 50d
go: clr p0.1
mov p2,#01h ;give 4 pulses in loop
acall delay ; total 200 pulses
mov p2,#02h ; each coil energized
acall delay ; one by on in single
setb p0.1
mov p2,#04h ; coil excitation
acall delay ; 30 ms delay in betwn
mov p2,#08h ; means speed is
acall delay ; 10 RPM
djnz r1,go
ret
aclkwise:
mov r1,#32h
go1:clr p0.2
mov p2,#01h
acall delay
mov p2,#08h ; revert the pulse
acall delay ; sequence for
setb p0.2
mov p2,#04h ; anticlockwise
acall delay
mov p2,#02h
acall delay
djnz r1,go1
ret
delay:
mov r5,#1Eh ; load count 30
lop2: mov r6,#FAh ; give 1 ms delay
lop1:nop ; so it gives full
nop ; 30 ms delay
djnz r6,lop1
djnz r5,lop2
ret
dely:
mov r5,#0C8h ; load count 200
lop2: mov r6,#0FAh ; for 200ms delay
lop1: nop
nop
djnz r6,lop1
djnz r5,lop2
ret
end
Program 2:-
Here in this program we shall limit the motor to rotate only 7.2o in either direction when the key is pressed. When first key is pressed motor rotates in clockwise direction and when second is pressed anticlockwise direction. LED1 and LED2 indicate the clockwise and anticlockwise rotation.
Note: – In industries this is also known as “jogging” (jog control). This is done to check in which direction motor will start running.
Org 00h
mov r0,#01h ; initileze key count
mov p1,#0ffh ; P1 as input port
lop: mov a,p1
cjne a,#0ffh,jmp
ajmp lop ; loop until any key is pressed
jmp: clr p0.0 ; indicates keypress
loop: rrc a
jnc num ; get key no.
inc r0
sjmp loop
num: acall dely ; key debounce delay
setb p0.0
cjne r0,#01h,nxt ; for 1st key
acall clkwise ; rotate motor
sjmp over ; clock wise
nxt: cjne r0,#02h,over ; for 2nd key
acall aclkwise ; rotate anticlock
over: mov p2,#00h ; restore initial
mov p1,#0ffh ; data and
mov r0,#01h
sjmp lop ; jump to loop again
clkwise:
clr p0.1
mov p2,#01h ;give 4 pulses in loop
acall delay ; as 1.8o step resolution
mov p2,#02h ; total 7.2o rotation
acall delay ; in single coil
setb p0.1
mov p2,#04h ; excitation
acall delay ; 30 ms delay in betwn
mov p2,#08h ; means speed is
acall delay ; 10 RPM
ret
aclkwise:
clr p0.1
mov p2,#01h
acall delay
mov p2,#08h ; revert the pulse
acall delay ; sequence for
setb p0.1
mov p2,#04h ; anticlockwise
acall delay
mov p2,#02h
acall delay
ret
delay:
mov r5,#1Eh ; load count 30
lop2: mov r6,#FAh ; give 1 ms delay
lop1:nop ; so it gives full
nop ; 30 ms delay
djnz r6,lop1
djnz r5,lop2
ret
dely:
mov r5,#0C8h ; load count 200
lop2: mov r6,#0FAh ; for 200ms delay
lop1:nop
nop
djnz r6,lop1
djnz r5,lop2
ret
end




















December 18th, 2008 at 9:05 pm
da program gives syntax error when it is build in keil software.
its give error for cjne a,#0ffh,jmp. n
jmp clr p0.0……..
December 19th, 2008 at 9:39 am
Hi, here jmp is used as a label. Please change jmp to some other name. for example
cjne a,#0ffh,keypress
keypress: clr p0.0
December 20th, 2008 at 9:01 pm
it also gives error here
lop2:mov r6,#FAh ; give 1 ms delay :the error is undefined symbol(pass 2).
lop2: mov r6,#0FAh ; for 200ms delay : attempt to define already defined label.
lop1: nop attempt to define already defined label.
December 21st, 2008 at 11:44 pm
hi plz tell me abt these error in program
n i m using of Seiko epson EM-198.
will it operate with 7805.
December 26th, 2008 at 4:07 pm
Hi replace “dely” function as given below.
———————-
dely:
mov r5,#0C8h ; load count 200
lop22: mov r6,#0FAh ; for 200ms delay
lop11:nop
nop
djnz r6,lop11
djnz r5,lop22
ret
———————–
January 22nd, 2009 at 8:34 am
Nothing seems to be easier than seeing someone whom you can help but not helping.
I suggest we start giving it a try. Give love to the ones that need it.
God will appreciate it.
June 14th, 2009 at 4:33 am
I’m new here on the forum, found it by searching google. I look forward to chatting about various topics with all of you.
August 7th, 2009 at 1:05 pm
It is interesting. Can you mail me the full details of the circuits
February 11th, 2010 at 7:30 pm
Good stuff. I like this blog. I will subscribe to it.
March 3rd, 2010 at 5:14 pm
very good circuit … can you mail the full details and explainations of the circuit.
March 7th, 2010 at 1:32 am
can u tell me how to control pitman motor using at89s51 through h bridge give ,jut move the motor in forward and reverse direction ,and also give me a small cobe to drive the motor through h bridge using at89s51
March 25th, 2010 at 3:37 pm
sperb thank u
April 5th, 2010 at 10:20 pm
А телефон свой не оставите? Хотелось бы кое-что обсудить по теме.
May 21st, 2010 at 10:45 am
hey the project is nice but is there any problem in the programs is they give error
June 3rd, 2010 at 10:11 am
hi, please give the full information about the stepper motor
June 14th, 2010 at 9:29 pm
72]Free Ringtones!
http://fastloannow.ru/ringtones/ringtones-19.jpg
72]Download Ringtones!
sprint lg ringtone
i730 free nextel ringtone
ring tone file type
free ringtones for v3a
gob ringtones
christian cellphone ringtones
club jet music ringtone
lotr ringtones
indianna jones ringtone
u s cellular fart ringtones
Fine Young Cannibals Ringtone
Razr V3a How To Unlock Ringtones
7100i Midi Ringtones
Ringtones Nokia 5140i Eagle
Pantech Duo Ringtone Mp3 Help
Free Polish National Ringtone
Styx Ringtones
Lg Incite Ringtones
Pass Alarm Ringtone
Listening Ringtone
Find Downloadable Ring Tones
Ringtones On
Record Your Own Ringtone
King Dedede Midi Free Ringtone
Hey Ya Ringtone
Free Polyphonic Ringtones Sony Erricson
Ringtone Tv Themes Free Download
8500 Audiovox Free Polyphonic Ringtone
Hifi Motorola V600 Mp3 Ringtones
Russian Christmas Ringtones
Happy Together Ringtones
Cheer Cincinnati Ringtone
Into Mp Ringtone Samsung Turn
Ringtones For Your Prepaid Cell Phone
Ringtone Lg-vx9900
Make Iphone Ringtone
2312333232i Free Nokia Phone Ringtone
Free Phone Ringtone Verizon Samsung
Listen To Ringtones From Disney
Woman Orgasm Ringtone
Chrstian Ringtones
Polyphonic Ringtones Online
Lg Vx3200 Wireless Ringtones
Ringtones College Sprint
College Fight Song Ring Tones
Kyocera Kx414 Game Ringtone
Download Ringtone Canada
Wwe The Rock Ringtones
Iphone Ringtones E
Add Ringtone To Palm Centro
Magix Ringtone Magix Ringtone
Free Comtempory Ringtones
Motorola V180 Cellular One Ringtones
Free Ringtones For Samsung M610
Embarq Ringtones
Uninsured Making Mp3 Ringtones
Iphone Ringtones Uk
837101222143 Music As A Ringtone
Hindi Mp3 Ringtones
Electric Avenue Ringtone Velvet
Free Motorola Ringtones To Download
Best Ringtones For Motorola Bc50
Download Nagging Ringtone Free
Free Michael Myers Ringtone
Motorola V233230233 Ringtone
Motorola Razr Ringtone Mp3
ringtones real one nokia
how to add ringtones
t500 ringtones
ringtones and graphics
i730 wav ringtone
droppin loads ringtone
free tie me down ringtone
remove ringtones came cell phone
motorola ringtone makers
sanyo 3100 ringtones
free ringtones boomer sooner
free pirates of the caribbean ringtones
ringtone toploader
silverstein ringtones
download free ringtone cricket
ringtones for adults
houston ringtones
free nextel ringtone software i
free verizon polyphonic ringtones sms
cingular downloads free ringtone
June 30th, 2010 at 5:42 pm
Nice project for learners. Is it available in kit form at a reasonable price?
Are the problems solved or still existing?
July 12th, 2010 at 10:30 am
Cheers, superb post.
July 29th, 2010 at 3:03 pm
Hi . . .can you mail me the full detail of the circuit diagram and the
program.