2011年12月28日星期三

51 SCM drive stepping motor circuits and program design

Here to introduce with 51 SCM drive stepping motor of the method.
This KuanBu into motor driving voltage of the 12 V, step Angle was 7.5 degrees. A circle 360 degrees, need 48 pulse finish!
http://www.siliconray.com/thumb-usb-stc-8051-mcu-programmer-1.html

The stepping motor has six of the lead, rankings are as follows: 1: red, 2: red, 3: orange, 4: brown, 5: yellow, 6: black.
The driver of the method ULN2003 51 driver.
ULN2003 driver directly in the single-chip microcomputer system 5 V voltage, may torque is not very big, you can increase by driving voltage to 12 V.


; * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
; * * * * * * * * * * * * * * * * * * * * * * * * * * * * the step motor drive * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


ORG 0000H
LJMP MAIN


ORG 0100H
MAIN:

MOV R3,#144   正转 3 圈共 144 脉冲

START:
MOV R0,#00H


START1:
MOV P2,#00H
MOV A,R0
MOV DPTR,#TABLE
MOVC A,@A+DPTR
JZ START   对 A 的判断,当 A = 0 时则转到 START


MOV P2,A
LCALL DELAY
INC R0
DJNZ R3,START1


MOV P2,#00H
LCALL DELAY1

;-----------------------------反转------------------------
MOV R3,#144    反转一圈共 144 个脉冲

START2:
MOV P2,#00H
MOV R0,#05


START3:
MOV A,R0
MOV DPTR,#TABLE
MOVC A,@A+DPTR
JZ START2


MOV P2,A
CALL DELAY
INC R0
DJNZ R3,START3


MOV P2,#00H
LCALL DELAY1

LJMP MAIN

DELAY: MOV R7,#40 步进电机的转速
M3: MOV R6,#248
DJNZ R6,$
DJNZ R7,M3
RET


DELAY1:            MOV   R4,#20    2S 延时子程序
DEL2:              MOV   R3,#200
DEL3:              MOV   R2,#250
                   DJNZ  R2,$
                   DJNZ  R3,DEL3
                   DJNZ  R4,DEL2
                   RET


TABLE:
DB 30H,60H,0C0H,90H  正转表
DB 00  正转结束


DB 30H,90H,0C0H,60H  反转表
DB 00  反转结束
END




没有评论:

发表评论