Design of flow control system based on microcontroller

Publisher:数字冲浪Latest update time:2023-06-20 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

MOV P1, A; Send 4#MC14495

RET


Stepper motor control program

The program code is as follows: ORG 2100H

PUSH ACC; protect the scene

MOV R4, #N; Stepper motor step number sends R4

CLR C; Cy cleared

ORL C, PSW.5; the steering sign status sends Cy

JC ROTE; if reversed, turn to ROTE

MOV R0, #20H; Send R0 to the starting address of the forward rotation model

AJMP NEXT; Go to NEXT

ROTE: MOV R0, #27H; reverse the starting address of the model and send R0

NEXT: MOV A, @R0; output the value of the control model

MOV P1, A; Output control pulse ACALL DELA

Y; Delay (form pulse width) INC R

0; Prepare the next model pointer MOV A, #00

H; Judge the model value after sending it once

ORL A,@R0 JZ TP

L; if the model ends, then TPL LOOP: DJNZ R4, NEXT; if the number of steps has not been completed, then N

EXT

POP AC

C;Restore scene

RE

T: return

TPL: MOV A, R0 CLR C

SUBB A, #06H MOV R0, A; restore model starting address

AJMP LOOP; Determine whether the stepper motor has completed the number of steps?

DELAY: MOV R2, #M1; delay

DELAY1: MOV R2, #M2

DELAY2:DEC A JNZ

DELAY2 DJNZ R2, DELAY1

RET

END


The above control program uses program delay to control the power-on time of the motor (that is, to form a control pulse) to achieve forward rotation, reverse rotation, start and stop. The disadvantage of this control is that the CPU efficiency is reduced due to the execution of delayed programs. In order to improve the utilization efficiency of the CPU, the internal timer/counter of the microcontroller can often be used to compile the above program.


[1] [2]
Reference address:Design of flow control system based on microcontroller

Previous article:Using microcontroller and FPGA to realize the design of delay-adjustable module in the system
Next article:Running on P89V51RD2 microcontroller based on μC/OS-II operating system

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号