-
Notifications
You must be signed in to change notification settings - Fork 0
/
10.StepperMotor.asm
57 lines (50 loc) · 1.14 KB
/
10.StepperMotor.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
; 10. Design and develop an assembly program to drive a Stepper Motor interface and rotate the
; motor in specified direction (clockwise or counter-clockwise) by N steps (Direction and N
; are specified by the examiner). Introduce suitable delay between successive steps. (Any
; arbitrary value for the delay may be assumed by the student).
.model small
.stack
.data
exit macro
mov ah, 4ch
int 21h
endm
send macro port, val
mov al, val
mov dx, port
out dx, al
endm
pa equ 0dc50h
cwr equ 0dc53h
.code
mov ax, @data
mov ds, ax
send cwr, 80h
mov al, 88h
mov cx, 200
back1:
send pa, al
call delay
ROR al, 1
loop back1
mov al, 88h
mov cx, 200
back2:
send pa, al
call delay
ROL al, 1
loop back2
exit
delay proc
push cx
mov cx, 0fffh
bck1:
mov bx, 0fffh
bck:
dec bx
jnz bck
loop bck1
pop cx
ret
delay endp
end