sao không có ai quan tâm vậy ta:
Mình potr tiếp file <LOAD_DATA_QUETLED5X7ASM.ASM>
Mình potr tiếp file <LOAD_DATA_QUETLED5X7ASM.ASM>
Code:
;======================================================== QUETLED: CJNE MODE_K,#1,KHAC LCALL LOADMODE12_24 RET KHAC: ;************LOA DATA GIO,PHUT GIAY VAO RAM****************** ;============================================================ LOADGIOPHUTGIAY: CJNE MODE_K,#0,KTG ;hien thi binh thuong mode_k=0 MOV TAM1,GIO LJMP LEDGIO KTG: CJNE MODE_K,#2,LEDGIO;KL_X LCALL CHOPSANG ; neu x>40 thi tat led JC LEDGIO MOV A,#0AAH MOV TAM1,#0AAH JMP CHOPGIO LEDGIO: MOV A,TAM1 CHOPGIO: MOV R0,#30H;30H ;Dia chi dau ;*********************** ; MOV A,GIO ;c5 LCALL LOADLEDN_CHUC_BOSO_0 ;gio chuc mau do ;*********** lcall laygiohienthi LCALL COTTRONG ;C6 ;*********** MOV 2AH,TAM1 MOV A,TAM1;GIO ;c11 LCALL LOADLEDN_DONVI ;gio donvi MOV TAM1,GIO ;*********** LCALL TRONGCHAM_N ;C14 ;*********************************** CJNE MODE_K,#2,_RET JB BIT12,_RET LCALL LODEAM_PM LCALL QUET7HANG RET _RET: ;*********************************** CJNE MODE_K,#0,KTP MOV TAM2,PHUT LJMP LEDPHUT KTP: CJNE MODE_K,#3,LEDPHUT LCALL CHOPSANG ; neu x>40 thi tat led JC LEDPHUT MOV A,#0AAH MOV TAM2,#0AAH JMP CHOPPHUT mov tam2,#0aah; LEDPHUT: MOV A,TAM2 CHOPPHUT: LCALL LOADLEDN_CHUC ;phut chuc ;*********** LCALL COTTRONG ;C20 ;*********** MOV A,TAM2 ;c25 LCALL LOADLEDN_DONVI ;phut donvi MOV TAM2,PHUT ;**************** LCALL TRONGCHAM_N ;C28 ;****************************** ;******************************* CJNE MODE_K,#0,KTGI MOV TAM3,GIAY LJMP LEDGIAY KTGI: CJNE MODE_K,#4,LEDGIAY LCALL CHOPSANG ; neu x>40 thi tat led JC LEDGIAY MOV A,#0AAH MOV TAM3,#0AAH JMP CHOPGIAY mov tam3,#0aah; LEDGIAY: MOV A,TAM3;NGAY CHOPGIAY: LCALL LOADLEDN_CHUC ;giay chuc ;*********** LCALL COTTRONG ;C34 ;*********** MOV A,TAM3 ;c39 LCALL LOADLEDN_DONVI ;giay donvi MOV TAM3,GIAY ;********************* LCALL COTTRONG ;40 ;*********************** LCALL QUET7HANG ;******************** RET ;*************************************************** ;*************************************************** ;************LOA DATA MODE HOUR AM/PM VAO RAM******* LODEAM_PM: ;GIO 11 COT JB AM_PM,QUA_PM LCALL LODECHU_AM ;bit AM_PM =0 la AM RET QUA_PM: LCALL LODECHU_PM RET ;********************** LODECHU_AM: PUSH 01H MOV DPTR,#BANG_AM ;25byte MOV R1,#0 MOV A,R1 LL_AM: MOVC A, @A+DPTR MOV @R0,A INC R0 INC R1 MOV A,R1 CJNE R1,#30,LL_AM POP 01H RET ;************************ LODECHU_PM: PUSH 01H MOV DPTR,#BANG_PM ;25byte MOV R1,#0 MOV A,R1 LL_PM: MOVC A, @A+DPTR MOV @R0,A INC R0 INC R1 MOV A,R1 CJNE R1,#30,LL_PM POP 01H RET ;************LOA DATA MODE HOUR 12/24 VAO RAM****************** ;============================================================ LOADMODE12_24: MOV R0,#30H;30H ;Dia chi dau LCALL LODECHUHOURS ;29 COT MOV A,MODE_NAO LCALL LOADLEDN_CHUC LCALL COTTRONG ;1 COT MOV A,MODE_NAO LCALL LOADLEDN_DONVI LCALL QUET7HANG RET ;****************************** LODECHUHOURS: PUSH 01H MOV DPTR,#BANG_HOUR ;25byte MOV R1,#0 MOV A,R1 LL_HOURS: MOVC A, @A+DPTR ; SWAP A MOV @R0,A INC R0 INC R1 MOV A,R1 CJNE R1,#29,LL_HOURS POP 01H RET ;**************************** ;*************************************************** ;*************************************************** ;*************************************************** ;*************************************************** laygiohienthi: ; TAM1 don vi ;GIOH_THI hang chuc push 01h mov a,GIOH_THI mov r1,#2AH swap a xchd a,@r1 mov GIOH_THI,a pop 01h ret ;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& ;*********************************************** QUET7HANG: PUSH 07H PUSH 00H MOV R7,#7 ;chon hang LAPHANG: MOV R0,#30H ;30H>>81H CLR RCK LAPCOT: CLR SCK MOV A,@R0 CLR C RRC A MOV @R0,A SETB SCK MOV SI,C INC R0 CJNE R0,#59H,LAPCOT SETB RCK MOV CHONHANG,R7;Sang hang LCALL DELAYLED MOV CHONHANG,#0 DJNZ R7,LAPHANG POP 00H POP 07H RET ;*********** ;*********************************************** ;*********************************************** boso8_9: cjne a,#8,no1 mov a,#0 ret no1:cjne a,#9,hi mov a,#1 hi :ret ;********************************************************* LOADLEDN_CHUC_BOSO_0: push 02h PUSH 01H MOV DPTR,#BANG_SO_NHO;hang chuc ANL A, #0F0H SWAP A lcall boso8_9 mov GIOH_THI,a ;luu tam gio hien thi SO H CHUC MOV B,#5 MUL AB cjne a,#0,no mov a,#50 no: MOV R1,A MOV R2,#5 LAPLAIB: MOVC A, @A+DPTR MOV @R0,A INC R0 INC R1 MOV A,R1 DJNZ R2,LAPLAIB POP 01H POP 02H RET ;******************************************* LOADLEDN_DONVI: push 02h PUSH 01H MOV DPTR,#BANG_SO_NHO ;don vi ANL A,#0FH MOV B,#5 MUL AB MOV R1,A MOV R2,#5 LAPLAI1_N: MOVC A, @A+DPTR MOV @R0,A INC R0 INC R1 MOV A,R1 DJNZ R2,LAPLAI1_N POP 01H POP 02H RET ;******************************************* LOADLEDN_CHUC: push 02h PUSH 01H MOV DPTR,#BANG_SO_NHO;hang chuc ANL A, #0F0H SWAP A MOV B,#5 MUL AB MOV R1,A MOV R2,#5 LAPLAIN: MOVC A, @A+DPTR MOV @R0,A INC R0 INC R1 MOV A,R1 DJNZ R2,LAPLAIN POP 01H POP 02H RET ;******************************************* TRONGCHAM_N:push 02h PUSH 01H MOV DPTR,#BANG_SO_NHO ;trong cham MOV A,#55 MOV R1,A MOV R2,#3 LAPLAITR_N:MOVC A, @A+DPTR MOV @R0,A INC R0 INC R1 MOV A,R1 DJNZ R2,LAPLAITR_N POP 01H POP 02H RET ;****************************************** CHAMCHOP: MOV A,1FH MOV @R0,A INC R0 RET ;******************************** COTTRONG: mov a,#0 ;cot trong mov @R0,a inc r0 RET ;******************************* DELAYLED: PUSH 04H PUSH 03H MOV R4,#10;4;2 D1 : MOV R3,#250 DJNZ R3,$ DJNZ R4,D1 POP 03H POP 04H RET ;*************************** ;************* BANG_SO_NHO : DB 3EH,7FH,41H,7FH,3Eh DB 11H,21H,7FH,7FH,01h DB 23H,67H,4DH,79H,31h DB 22H,63H,49H,7FH,36h DB 0EH,1AH,32H,7FH,7Fh DB 72H,73H,51H,5FH,4eh DB 3EH,7FH,49H,6FH,26h DB 43H,47H,4cH,78H,70h DB 36H,7FH,49H,7FH,36h DB 32H,7BH,49H,7FH,3Eh DB 00H,00H,00H,00H,00H DB 00H,14H,00H ;************* BANG_AM: DB 0h,0H,0H,1FH,3FH,28H,3FH,1FH,0H,3FH DB 3FH,20H,3FH,3FH,20H,3FH,1FH ,0H,0H,0H ;AM 20BYTE DB 0H,0H,0H,0H,0H,0H,0H,0H,0H,0H,0H BANG_PM: DB 0H,0H,0H,3FH,3FH,24H,3CH,18H,0H,3FH DB 3FH,20H,3FH,3FH,20H,3FH,1FH,0H,0H,0H;PM DB 0H,0H,0H,0H,0H,0H,0H,0H,0H,0H,0H ;************* BANG_HOUR: DB 7FH,7FH,10H,1FH,0FH,0H,0EH,1FH,11H,1FH,0EH,0H DB 1EH,1FH,1H,1EH,1FH,0H,1FH,1FH,8H,10H,8H,0H;HUUR 24BYTE DB 8H,2AH,1CH,8H,0H ;5B
Comment