loading...

Stepper motor interface to rotate the motor in anticlockwise by N steps using ALP

The following ALP derives a stepper motor interface to rotate the motor in anticlockwise direction by N steps.

 
DATA SEGMENT
pa equ 0d880h
pb equ 0d881h
pc equ 0d882h
cw equ 0d883h
Data ends
CODE SEGMENT
assume cs:code,ds:data
Start:      mov ax,data
            mov ds,ax
            mov dx,cw
            mov al,80h
            out dx,al
            mov dx,pc
            mov cl,32h
Up:         mov al,0eeh
            out dx,al
            call delay
            mov al,0ddh
            out dx,al
            call delay
            mov al,0bbh
            out dx,al
            call delay
            mov al,077h
            out dx,al
            call delay
            dec cl
            jnz up
            mov ah,4ch
            int 21h
delay proc near
           push ax
           push cx
           push bx
           mov cx,0fffh
loop2:     mov bx,0fffh
loop3:     dec bx
           jnz loop3
           loop loop2
           pop bx
           pop cx
           pop ax
           ret 
           delay endp
           code ends
           end start



The output of given code is –

 
Output:
Stepper motor rotates anticlockwise direction at a speed of 0fffh [4095]d RPM.

Also read: Cloud Computing – 5 reasons to rely on

0 4

Leave a Reply

Your email address will not be published.