下面是我自己想着编的时钟程序,感觉能想到的都想了,不知还有没有什么不妥,请各位大虾指教啊,欢迎大家多提批评意见,我是刚学编程的,就像别人给我挑毛病,这样才能进步啊,呵呵! ORG 0000H LJMP MAIN ORG 000BH LJMP TT0INT ORG 0030H MAIN: MOV SP,#6FH MOV TMOD,#01H SETB EA SETB ET0 SETB TR0 MOV TH0,#3CH ;(50MS) MOV TL0,#0B0H MOV R7,#04H MOV R6,#60 MOV R5,#60 MOV R4,#24 MOV R3,#00H MOV R2,#00H MOV R1,#00H SJMP $ TT0INT: MOV TH0,#3CH MOV TL0,#0B0H DJNZ R7,EXIT MOV R7,#04H INC R3 DJNZ R6,SECOND MOV R3,#00H MOV R6,#60 INC R2 DJNZ R5,MINUTE MOV R2,#00H MOV R2,#00H MOV R5,#60 INC R1 DJNZ R4,HOUR MOV R1,#00H MOV R4,#24 HOUR: MOV A,R1 MOV 30H,A MOV B,#10 DIV AB MOV 33H,A MOV 34H,B MINUTE: MOV A,R2 MOV 31H,A MOV B,#10 DIV AB MOV 35H,A MOV 36H,B SECOND: MOV A,R3 MOV 32H,A MOV B,#10 DIV AB MOV 37H,A MOV 38H,B EXIT: RETI END |