$MOD51 STACK_BUF EQU 60H T0_CNT DATA 20H F_1SEC BIT T0_CNT.4 ; 12 MHz F_SEC BIT T0_CNT.7
ORG 0000H AJMP START NOP ORG 000BH ; INT T0 JBC F_1SEC, SUB_1SEC INC T0_CNT NOP INT_RET: RETI NOP ;--------------------------------- ORG 0088H SUB_1SEC: MOV T0_CNT, A CLR EA PUSH PSW CLR TR0 MOV A, TL0 ADD A, #LOW(0BDC0H + 6) MOV TL0, A MOV A, TH0 ADDC A, #HIGH(0BDC0H+6) MOV TH0, A SETB TR0 POP PSW SETB EA MOV A, #1 XCH A, T0_CNT ACALL INT_RET ;***** 1 SEC SERVICE ;....... SETB F_SEC ;....... RET ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% START: MOV SP, #(STACK_BUF-1) MOV T0_CNT, #0 ; Configure Timer 0 ; - Mode = 1 ; - Interrupt = ENABLED ; - Clock Source = INTERNAL ; - Enable Gating Control = DISABLED MOV TMOD, #01h ; ;setb IE.1 MOV IE, #10000010B setb TR0 ;TCON.4 start timer NOP ;$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ MAINLOOP: SJMP MAINLOOP ;______________________________________ END ;---------------------------- |