Circuit and program design of 51 single chip microcomputer driving stepper motor

Publisher:InnovateMindLatest update time:2016-11-16 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Here is an introduction to the method of using a 51 single-chip microcomputer to drive a stepper motor. 
The driving voltage of this stepper motor is 12V, and the step angle is 7.5 degrees. One circle is 360 degrees, and it takes 48 pulses to complete!!! 
 

51 single chip microcomputer driving stepper motor circuit and program design - Huaxia people - Jianglou Fengfang

The stepper motor has 6 leads, arranged in the following order: 1: red, 2: red, 3: orange, 4: brown, 5: yellow, 6: black. It is 
driven by 51 driving ULN2003.  The ULN2003 is driven directly by the 5V voltage of the microcontroller system, so the torque is not very large. You can increase the driving voltage to 12V. 
 51 single chip microcomputer driving stepper motor circuit and program design - Huaxia people - Jianglou Fengfang

 

;************************************************************************************
;********************************Stepper motor drive***************************************
; DESIGN BY BENLADN911 FOSC = 12MHz 2005.05.19
;---------------------------------------------------------------------------------
; The driving signal of the stepper motor must be a pulse signal!!! The speed of rotation is proportional to the frequency of the pulse!!!
; The step angle of this stepper motor is 7.5 degrees. One circle is 360 degrees, and 48 pulses are required to complete!!!
;---------------------------------------------------------------------------------

; Group A coil corresponds to P2.4
; Group B coil corresponds to P2.5
; Group C coil corresponds to P2.6
; Group D coil corresponds to P2.7
; Forward rotation order: Group AB--Group BC--Group CD--Group DA (i.e. one pulse, 7.5 degrees forward rotation)
;----------------------------------------------------------------------------------
;----------------------------Forward rotation--------------------------
ORG 0000H
LJMP MAIN

ORG 0100H
MAIN:

MOV R3,#144 forward rotation 3 turns, total 144 pulses

START:
MOV R0,#00H

START1:
MOV P2,#00H
MOV A,R0
MOV DPTR,#TABLE
MOVC A,@A+DPTR
JZ START judges A, when A = 0, go to START

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

MOV P2,#00H
LCALL DELAY1

;-----------------------------Reverse------------------------

MOV R3,#144 reverses one circle, a total of 144 pulses

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 Stepper motor speed
M3: MOV R6,#248
DJNZ R6,$
DJNZ R7,M3
RET

DELAY1: MOV R4,#20 2S delay subroutine
DEL2: MOV R3,#200
DEL3: MOV R2,#250
                   DJNZ R2,$
                   DJNZ R3,DEL3
                   DJNZ R4,DEL2
                   RET

TABLE:
DB 30H,60H,0C0H,90H Forward table
DB 00 Forward end

DB 30H,90H,0C0H,60H Reverse table
DB 00 Reverse end
END


Reference address:Circuit and program design of 51 single chip microcomputer driving stepper motor

Previous article:51 MCU I/O port read and write operations
Next article:Implementation of Real-time Operating System Based on 51 Single-Chip Microcomputer

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号