;------------- T0 INTRRUPT 数码管扫描定时中断--------------------------- T0_INT: PUSH ACC PUSH PSW MOV TH0,#240 ;T0=4MS MOV TL0,#96 INC BUFF_LED_LP MOV A,BUFF_LED_LP CJNE A,#06,CONT_SCAN ;250*4MS=1S MOV BUFF_LED_LP,#00H CONT_SCAN:MOV A,BUFF_LED_LP RL A MOV DPTR,#TAB_SCAN JMP @A+DPTR TAB_SCAN: AJMP SCAN_L1 AJMP SCAN_L2 AJMP SCAN_L3 AJMP SCAN_L4 AJMP SCAN_L5 AJMP SCAN_L6 SCAN_L1: MOV DIG_PORT,#01111111B MOV A,BUFF_LED1 JMP END_SCAN SCAN_L2: MOV DIG_PORT,#10111111B MOV A,BUFF_LED2 JMP END_SCAN SCAN_L3: MOV DIG_PORT,#11011111B MOV A,BUFF_LED3 JMP END_SCAN SCAN_L4: MOV DIG_PORT,#11101111B MOV A,BUFF_LED4 JMP END_SCAN SCAN_L5: MOV DIG_PORT,#11110111B MOV A,BUFF_LED5 JMP END_SCAN SCAN_L6: MOV DIG_PORT,#11111011B MOV A,BUFF_LED6 END_SCAN: MOV DPTR,#TAB_LED MOVC A,@A+DPTR MOV LED_PORT,A JNB F_BEEP,EXIT_T0 CLR BEEP EXIT_T0: POP PSW POP ACC RETI
TAB_LED: DB 0C0H,0F9H,0A4H,0B0H,99H,92H ;数码管显示字型表 DB 82H,0F8H,80H,90H,88H,83H,0A7H DB 0A1H,86H,8EH,0FFH END
|