CODEKTVXLNCNT
ORG 0000H
LJMP START
;---------------------------------
ORG 03H ;external interrupt 0
RETI
ORG 0BH ;timer 0 interrupt
RETI
ORG 13H ;external interrupt 1
RETI
ORG 1BH ;timer 1 interrupt
RETI
ORG 23H ;serial port interrupt
RETI
;=====================================
ORG 30H
;=====================================
KHOI_TAO: ;set up control registers
MOV TCON,#00H
MOV TMOD,#00H
MOV PSW,#00H
MOV IE,#00H ;disable interrupts
RET
;-------------------------------------
;HAM MAIN
;-------------------------------------
;ORG 30H
START:
ACALL KHOI_TAO ;KHOI TAO CAC THANH GHI
MOV A,#6
MOV R3,A
CJNE A,#2,KTRA
LJMP NGTO
KTRA:
MOV R0,A
MOV R1,#2
NHAY:
MOV B,R1
DIV AB
MOV R2,B
CJNE R2,#0,TIEP
JMP BT
TIEP:
INC R1
MOV 1DH,R1
CJNE A,1DH,NHAY
NGTO:
MOV P1,R3
SJMP KT
BT:
MOV P2,R3
KT:
END
END
Bạn đang đọc truyện trên: AzTruyen.Top