Các bác cho em hỏi VDK này là con j đây ? Thank các bác
Code:
ORG 0000H JMP BEGIN ORG 0003H JMP NGAT_NGOAI0_VECTOR ORG 000BH JMP TIMER0_VECTOR ORG 0030H BEGIN: ;THIET LAP CHE DO CHO TIMER 0 VA NGAT NGOAI GIATRITIMER0 EQU 25903 MOV IE,#83H ;CHO PHEP NGAT TIMER 0 VA NGAT NGOAI0 SETB TCON.0 ;CHON NGAT NGOAI KICH SUON XUONG MOV TMOD,#01H ;CHO CHE DO 1 CHO TIMER O MOV TH0,# HIGH (GIATRITIMER0) MOV TL0,# LOW (GIATRITIMER0) ;NAP BIT CAO BAN DAU CHO TIMER 0; ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;LUU MA CUA CAC SO TU 0->9 VAO CAC O NHO MOV 70H,#7FH ;LUU MA SO 0 MOV 71H,#0EH ;----------1 MOV 72H,#0B7H ;----------2 MOV 73H,#9FH ;LUU MA SO 3 MOV 74H,#0CEH ;LUU MA SO 4 MOV 75H,#0DDH ;LUU MA SO 5 MOV 76H,#0FDH ;LUU MA SO 6 MOV 77H,#0FH ;LUU MA SO 7 MOV 78H,#0FFH ;LUU MA SO 8 MOV 79H,#0DFH ;LUU MA SO 9 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ;LUU GIA TRI THOI GIAN BAN DAU MOV 40H,#0 ;CHUC GIO BANG 0 MOV 41H,#0 ;GIO BANG 0 MOV 42H,#0 ;CHUC PHUT BANG 0 MOV 43H,#0 ;PHUT BANG 0 MOV 44H,#0 ;CHUC GIAY VA GIAY BANG 0 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX SETB TR0 ;BAT TIMER 0 ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX LAPLAI: CALL HIENTHI CALL XULY_THOIGIAN JMP LAPLAI ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX HIENTHI: MOV A,40H ;HIEN THI CHUC GIO MOV R0,#70H ; ADD A,R0 ; MOV R0,A ; MOV P3,@R0 ; MOV A,41H ;HIEN THI GIO MOV R0,#70H ; ADD A,R0 ; MOV R0,A ; MOV P1,@R0 ; MOV A,42H ;HIEN THI CHUC PHUT MOV R0,#70H ; ADD A,R0 ; MOV R0,A ; MOV P0,@R0 ; MOV A,43H ;HIEN THI PHUT MOV R0,#70H ; ADD A,R0 ; MOV R0,A ; MOV P2,@R0 ; RET ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XULY_THOIGIAN: MOV A,44H CJNE A,#60,THOAT_XULY MOV 44H,#0 ;GIAY = 0 INC 43H ;TANG PHUT MOV A,43H CJNE A,#10,THOAT_XULY MOV 43H,#0 ;PHUT BANG 0 INC 42H ;TANG CHUC PHUT MOV A,42H CJNE A,#6,THOAT_XULY MOV 42H,#0 ; CHUC PHUT BANG 0 MOV A,40H CJNE A,#2,TTG ; SO SANH CHUC GIO INC 41H ;TANG GIO MOV A,41H CJNE A,#4,THOAT_XULY; SO SANH GIO VOI 4 MOV 40H,#0 ;CHUC GIO BANG 0 MOV 41H,#0 ;GIO BANG 0 MOV 42H,#0 ;CHUC PHUT BANG 0 MOV 43H,#0 ;PHUT BANG 0 MOV 44H,#0 ;CHUC GIAY VA GIAY BANG 0 JMP THOAT_XULY TTG: INC 41H MOV A,41H CJNE A,#10,THOAT_XULY MOV 41H,#0 ; EP GIO BANG 0 INC 40H ; TANG CHUC GIO THOAT_XULY: RET ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX NGAT_NGOAI0_VECTOR: ;CHUONG TRINH CON XU LI PHIM VA TNAG THOI GIAN THEO PHIM ;CLR IE.0 ; XOA DIEU KIEN NGAT NGOAI DE XU LY PHIM MENU SETB P1.2 ; BAO TRANG THAI CHINH GIO MOV R4,#50 DOCPHIM: CALL HIENTHI CALL DELAY_PHIM_200MS MOV A,P0 ; DOC P0 ANL A,#04H ; CHI LAY RA P0.2 MOV R1,A ; LUU P0 VAO R1 MOV A,P2 ANL A,#04H MOV R2,A ;MOV A,P3 ;ANL A,#04H ;MOV R3,A CJNE R1,#0,DEN_PHIM_GIO; XEM P0.2 CO DUOC NHAN ?(BANG 0) INC 43H ;TANG PHUT MOV A,43H CJNE A,#10,DOCPHIM MOV 43H,#0 ;PHUT BANG 0 INC 42H ;TANG CHUC PHUT MOV A,42H CJNE A,#6,DOCPHIM MOV 42H,#0 ; CHUC PHUT BANG 0 JMP DOCPHIM DEN_PHIM_GIO: CJNE R2,#0,DEN_PHIM_MENU; XEM PHIM GIO CO DUOC NHAN? MOV A,40H CJNE A,#2,TTG1 ; SO SANH CHUC GIO INC 41H ;TANG GIO MOV A,41H CJNE A,#4,DOCPHIM; SO SANH GIO VOI 4 MOV 40H,#0 ;CHUC GIO BANG 0 MOV 41H,#0 ;GIO BANG 0 JMP DOCPHIM TTG1: INC 41H MOV A,41H CJNE A,#10,DOCPHIM MOV 41H,#0 ; EP GIO BANG 0 INC 40H ; TANG CHUC GIO JMP DOCPHIM DEN_PHIM_MENU: DJNZ R4,DOCPHIM ;CJNE R3,#0,DOCPHIM ;MOV R3,#10 ;HERE: CALL DELAY_PHIM_200MS ;DJNZ R3,HERE ;SETB IE.0 RETI ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX TIMER0_VECTOR: CLR TR0 clr p1.2 MOV 60H,#7 BACK1: MOV 61H,#250 BACK2: MOV 62H,#250 BACK3: DJNZ 62H,BACK3 DJNZ 61H,BACK2 DJNZ 60H,BACK1 INC 44H ;TANG GIAY MOV TH0,# HIGH (GIATRITIMER0) MOV TL0,# LOW (GIATRITIMER0) SETB TR0 RETI ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX DELAY_PHIM_200MS: MOV R7,#10 D3:MOV R6,#100 D2:MOV R5,#100 D1:DJNZ R5, D1 DJNZ R6, D2 DJNZ R7, D3 RET ;XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX END
Comment