51 single chip microcomputer drives stepper motor (assembly language)

Publisher:Dingsir1902Latest update time:2015-05-08 Source: 51hei 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 51 single-chip microcomputer to drive stepper motor.
The driving voltage of this stepper motor is 12V, and the step angle is 7.5 degrees. A circle of 360 degrees requires 48 pulses to complete!!!
This stepper motor has 6 leads, arranged in the following order: 1: red, 2: red, 3: orange, 4: brown, 5: $, 6: black.
Use the method of 51 to drive ULN2003 to drive.
The drive of ULN2003 directly uses the 5V voltage of the single-chip microcomputer system, but the torque is not very large. You can increase the driving voltage to 12V by yourself.  ;******************************************************************   ;****************************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 of 360 degrees requires 48 pulses 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 order: Group AB--Group BC--Group CD--Group DA (i.e. one pulse, forward 7.5 degrees)   ;----------------------------------------------------------------------------------   ;----------------------------Forward--------------------------   ORG 0000H   LJMP MAIN   ORG 0100H   MAIN:   MOV R3,#144 Forward rotation for 3 circles, a total of 144 pulses   START:   MOV R0,#00H   START1:   MOV P2,#00H   MOV A,R0   MOV DPTR,#TABLE   MOVC A,@A+DPTR   JZ START Judge A, when A = 0, then jump to START   MOV P2,A   LCALL DELAY   INC R0   DJNZ R3,START1   MOV P2,#00H   LCALL DELAY1   ;-----------------------------Reverse rotation------------------------   MOV R3,#144 Reverse rotation for 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




































































Reference address:51 single chip microcomputer drives stepper motor (assembly language)

Previous article:Thermal flow sensor signal acquisition
Next article:Experience in implementing a remote-controlled smart car 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号