Skip to content

Commit

Permalink
Add .a51 sample
Browse files Browse the repository at this point in the history
  • Loading branch information
hearsilent committed Oct 19, 2014
1 parent 55ecc5f commit 35aa576
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions samples/Assembly/External Interrupt.a51
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
ORG 0000h
SJMP START
ORG 0003h
LCALL INT0_ISR
RETI
ORG 000Bh
LCALL T0_ISR
RETI
ORG 0013h
LCALL INT1_ISR
RETI
ORG 001Bh
LCALL T1_ISR
RETI
ORG 0023h
LCALL UART_ISR
RETI
ORG 0030h
START:
MOV A,#11111110b
SETB IT0 ; Set External Interrupt 0 to be falling edge triggered
SETB EX0 ; Enable External Interrut 0
SETB EA ; Enable Interrupt
LEFT:
CJNE A,#01111111b,LOOP1
JMP RIGHT
LOOP1:
MOV P1,A
RL A
LCALL DELAY
SJMP LEFT
RIGHT:
CJNE A,#11111110b,LOOP2
JMP LEFT
LOOP2:
MOV P1,A
RR A
LCALL DELAY
SJMP RIGHT
INT0_ISR:
MOV R1,#3
FLASH:
MOV P1,#00h
LCALL DELAY
MOV P1,#0FFh
LCALL DELAY
DJNZ R1,FLASH
RET
T0_ISR:
RET
INT1_ISR:
RET
T1_ISR:
RET
UART_ISR:
RET

DELAY: MOV R5,#20 ;R5*20 mS
D1: MOV R6,#40
D2: MOV R7,#249
DJNZ R7,$
DJNZ R6,D2
DJNZ R5,D1
RET
END

0 comments on commit 35aa576

Please sign in to comment.