External Interrupt Stepper Motor PDF
External Interrupt Stepper Motor PDF
5:
AIM: To Develop an ALP to accept the external interrupt and to toggle the LED
SOFTWARE USED: MCU8051
PROGRAM:
ORG 0000H
LJMP MAIN
ORG 0003H
CPL P1.0
acall delay
acall delay
acall delay
acall delay
acall delay
RETI
ORG 0013H
CPL P1.1
acall delay
acall delay
acall delay
acall delay
acall delay
RETI
MAIN:
MOV IE,#85H
again:
mov p2,#00h
mov a,#01h
mov p2,a
acall delay
acall delay 21
acall delay
mov a,#03h
mov p2,a
acall delay
acall delay
acall delay
mov a,#07h
mov p2,a
acall delay
acall delay
acall delay
mov a,#0fh
mov p2,a
acall delay
acall delay
acall delay
SJMP again
delay:
Page | 17
mov r0,#0ffh
here1: mov r1,#0ffh
here: djnz r1,here
djnz r0,here1
ret
END
RESULT: An ALP is developed to accept the external interrupt and accordingly the LED’s were made to
toggle.
Page | 18
EXPERIMENT NO.6:
AIM: To Develop an ALP to accept the timers interrupt and to toggle the LED when timer generates
Interrupt.
SOFTWARE USED: MCU8051
PROGRAM:
ORG 00H
SJMP START
ORG 000BH
CPL P1.1
RETI
ORG 30H
START:
MOV A,#38H
ACALL CMD
MOV A,#06H
ACALL CMD
MOV A,#01H
ACALL CMD
MOV A,#0EH
ACALL CMD
MOV A,#80H
ACALL CMD
MOV TMOD, #02H
MOV TH0, #44H
SETB TR0
MOV IE,#82H
back:
MOV A, #'C'
ACALL DAT
ACALL DELAY
ACALL DELAY
ACALL DELAY
SJMP back
CMD: MOV P0, A
CLR P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DAT:MOV P0,A
SETB P2.0
CLR P2.1
SETB P2.2
ACALL DELAY
CLR P2.2
RET
DELAY: MOV R3,#0FEH
Page | 19
LOOP2: MOV R4,#0C3H
LOOP1: DJNZ R4,LOOP1
DJNZ R3,LOOP2
RET
END
Page | 20
EXPERIMENT NO.8:
AIM: To Develop an ALP to interface to STEPPER MOTOR:
SOFTWARE USED: MCU8051
PROGRAM:
ORG 0H
MOV A,#00110011B
LOOP1: MOV P2,A
ACALL DELAY
RL A;RR A ROTATE LEFT OR ROTATE RIGHT
SJMP LOOP1
DELAY: MOV R7,#0FFH
HERE2: MOV R6,#0FFH
HERE1: DJNZ R6,HERE1
DJNZ R7,HERE2
RET
END
OUTPUT:
Page | 21