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.
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
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Brief Analysis of Automotive Ethernet Test Content and Test Methods
- How haptic technology can enhance driving safety
- Why? The 32768 in MSP430F2001 does not oscillate
- Construction of CCS v5 software development environment for TMS320C6000
- About the IP address routing of the WiFi module
- DSP TMS320F28335 interrupt vector table
- (3) UART DMA plus IDLE interrupt indefinite length byte reception
- This positioning hole and via are the same as repairing a building.
- SVPWM control of sensored BLDC cannot start when fixed sector 5
- TMS570 Learning 1- Creating Engineering Lighting
- Wireless data acquisition, environmental monitoring, gas monitoring, remote temperature and humidity monitoring, chemical environmental monitoring solutions
- Registration is open | TI live award-winning broadcast: Current and voltage measurement solutions in servo drives