; .\time.SRC generated from: time.c
; COMPILER INVOKED BY:
; C:\Keil\C51\BIN\C51.EXE time.c LARGE BROWSE DEBUG OBJECTEXTEND SRC(.\time.SRC)
$NOMOD51
NAME TIME
CCF2 BIT 0D8H.2
TB80 BIT 098H.3
SPI0CKR DATA 0A2H
CCF3 BIT 0D8H.3
P0 DATA 080H
SPIEN BIT 0F8H.0
CCF4 BIT 0D8H.4
P1 DATA 090H
P2 DATA 0A0H
ADC0CF DATA 0BCH
P3 DATA 0B0H
AC BIT 0D0H.6
PCA0 DATA 0F9H
EIE1 DATA 0E6H
EA BIT 0A8H.7
MCE0 BIT 098H.5
PSCTL DATA 08FH
CF BIT 0D8H.7
IT01CF DATA 0E4H
ADC0CN DATA 0E8H
D0IN BIT 090H.4
P0MDOUT DATA 0A4H
DI BIT 0A0H.4
D1IN BIT 090H.5
P1MDOUT DATA 0A5H
TMR2RLH DATA 0CBH
IE DATA 0A8H
P2MDOUT DATA 0A6H
P3MDOUT DATA 0A7H
TMR3RLH DATA 093H
EIP1 DATA 0F6H
TRIG_OUT BIT 0B0H.4
W_FLG BIT 0A0H.3
TXBMT BIT 0F8H.1
PCA0CPH0 DATA 0FCH
TMR2RLL DATA 0CAH
PCA0CPH1 DATA 0EAH
TMR3RLL DATA 092H
DP DATA 082H
PCA0CPH2 DATA 0ECH
ADC0GT DATA 0C3H
CR BIT 0D8H.6
TF2H BIT 0C8H.7
T2SPLIT BIT 0C8H.3
PCA0CPH3 DATA 0EEH
REN0 BIT 098H.4
PCA0CPH4 DATA 0FEH
PCA0CPL0 DATA 0FBH
RE BIT 0A0H.5
PCA0CPL1 DATA 0E9H
PCA0CPM0 DATA 0DAH
PCA0MD DATA 0D9H
PCA0CN DATA 0D8H
PCA0CPL2 DATA 0EBH
PCA0CPM1 DATA 0DBH
TF2L BIT 0C8H.6
PCA0CPL3 DATA 0EDH
PCA0CPM2 DATA 0DCH
IP DATA 0B8H
ADC0LT DATA 0C5H
X_SCK BIT 080H.0
ARBLOST BIT 0C0H.2
PCA0CPL4 DATA 0FDH
PCA0CPM3 DATA 0DDH
PCA0CPM4 DATA 0DEH
INT0 BIT 080H.7
TXBSY BIT 0F8H.3
CY BIT 0D0H.7
SI BIT 0C0H.0
LEDG BIT 080H.3
XBR0 DATA 0E1H
SMB0CF DATA 0C1H
XBR1 DATA 0E2H
EMI0CN DATA 0AAH
BELL BIT 0A0H.7
REF0CN DATA 0D1H
AD0INT BIT 0E8H.5
SP DATA 081H
OV BIT 0D0H.2
SMB0CN DATA 0C0H
TMR2 DATA 0CCH
TMR3 DATA 094H
MODF BIT 0F8H.5
LEDR BIT 080H.2
RX BIT 080H.5
S0MODE BIT 098H.7
VDM0CN DATA 0FFH
P0MDIN DATA 0F1H
CPT0MD DATA 09DH
CPT0CN DATA 09BH
P1MDIN DATA 0F2H
CPT1MD DATA 09CH
CPT1CN DATA 09AH
TX BIT 080H.4
P2MDIN DATA 0F3H
TF2LEN BIT 0C8H.5
P3MDIN DATA 0F4H
TRIG_IN BIT 0B0H.3
SPI0CN DATA 0F8H
W_RST BIT 0A0H.6
PCON DATA 087H
SPIF BIT 0F8H.7
nsel BIT 090H.0
TMOD DATA 089H
TCON DATA 088H
WCOL BIT 0F8H.6
TRIG BIT 0A0H.1
TMR2CN DATA 0C8H
P0SKIP DATA 0D4H
TMR3CN DATA 091H
nres BIT 080H.7
T2XCLK BIT 0C8H.0
P1SKIP DATA 0D5H
P2SKIP DATA 0D6H
IE0 BIT 088H.1
CPT0MX DATA 09FH
IE1 BIT 088H.3
OSCICL DATA 0B3H
CPT1MX DATA 09EH
CLKSEL DATA 0A9H
sdi BIT 080H.6
B DATA 0F0H
ADC0H DATA 0BEH
OSCICN DATA 0B2H
sck BIT 080H.0
TMR2RL DATA 0CAH
ADC0L DATA 0BDH
TMR3RL DATA 092H
sdo BIT 080H.1
ACC DATA 0E0H
ES0 BIT 0A8H.4
PCA0CP0 DATA 0FBH
AD0EN BIT 0E8H.7
ET0 BIT 0A8H.1
PCA0CP1 DATA 0E9H
ET1 BIT 0A8H.3
TF0 BIT 088H.5
PCA0CP2 DATA 0EBH
D0W BIT 090H.2
ET2 BIT 0A8H.5
RI0 BIT 098H.0
TF1 BIT 088H.7
PCA0CP3 DATA 0EDH
D1W BIT 090H.3
TH0 DATA 08CH
PCA0CP4 DATA 0FDH
EX0 BIT 0A8H.0
TI0 BIT 098H.1
IT0 BIT 088H.0
PCA0H DATA 0FAH
TH1 DATA 08DH
X_CS BIT 090H.1
MASTER BIT 0C0H.7
EX1 BIT 0A8H.2
IT1 BIT 088H.2
P BIT 0D0H.0
ACK BIT 0C0H.1
OSCXCN DATA 0B1H
TL0 DATA 08AH
PCA0L DATA 0F9H
TL1 DATA 08BH
TXMODE BIT 0C0H.6
PS0 BIT 0B8H.4
WIE_CK BIT 0A0H.0
X_SI BIT 080H.6
PT0 BIT 0B8H.1
RS0 BIT 0D0H.3
PT1 BIT 0B8H.3
RS1 BIT 0D0H.4
PT2 BIT 0B8H.5
TR0 BIT 088H.4
AD0TM BIT 0E8H.6
TR1 BIT 088H.6
RELAY_OUT BIT 0B0H.2
TR2 BIT 0C8H.2
PX0 BIT 0B8H.0
PX1 BIT 0B8H.2
X_SO BIT 080H.1
SLVSEL BIT 0F8H.2
DPH DATA 083H
ADC0GTH DATA 0C4H
DPL DATA 082H
ADC0GTL DATA 0C3H
SBUF0 DATA 099H
ADC0LTH DATA 0C6H
RSTSRC DATA 0EFH
FLACL DATA 0B5H
SCON0 DATA 098H
AMX0N DATA 0BAH
ADC0LTL DATA 0C5H
AMX0P DATA 0BBH
STA BIT 0C0H.5
D0OUT BIT 090H.6
SMB0DAT DATA 0C2H
D1OUT BIT 090H.7
TMR2H DATA 0CDH
SPI0CFG DATA 0A1H
TMR3H DATA 095H
CKCON DATA 08EH
IN_OUT BIT 0A0H.2
RXOVRN BIT 0F8H.4
TMR2L DATA 0CCH
ACKRQ BIT 0C0H.3
TMR3L DATA 094H
F0 BIT 0D0H.5
FLSCL DATA 0B6H
RELAY_IN BIT 0B0H.1
AD0CM0 BIT 0E8H.0
F1 BIT 0D0H.1
STO BIT 0C0H.4
AD0CM1 BIT 0E8H.1
SPI0DAT DATA 0A3H
ADC0 DATA 0BDH
AD0CM2 BIT 0E8H.2
AD0WINT BIT 0E8H.3
AD0BUSY BIT 0E8H.4
PSW DATA 0D0H
CCF0 BIT 0D8H.0
RB80 BIT 098H.2
FLKEY DATA 0B7H
CCF1 BIT 0D8H.1
?PR?Timer0_Init?TIME SEGMENT CODE
?PR?_Timer2_Init?TIME SEGMENT CODE
?PR?Timer0_ISR?TIME SEGMENT CODE
?PR?Timer2_ISR?TIME SEGMENT CODE
?XD?TIME SEGMENT XDATA
?C_INITSEG SEGMENT CODE
EXTRN BIT (wie_str)
EXTRN XDATA (event_word)
PUBLIC Timer2_ISR
PUBLIC Timer0_ISR
PUBLIC _Timer2_Init
PUBLIC Timer0_Init
RSEG ?XD?TIME
count1?341: DS 2
RSEG ?XD?TIME
count2?342: DS 2
RSEG ?XD?TIME
count3?343: DS 2
RSEG ?C_INITSEG
DB 042H
DW count1?341
DW 00000H
DB 042H
DW count2?342
DW 00000H
DB 042H
DW count3?343
DW 00000H
; #include "global.h"
;
;
; /******************************************************************************
; ** 函数: Timer0_Init ()
; ** 入参: 无
; ** 返回: 无
; ** 说明: 查询wiegand溢出,每5ms溢出中断,10ms溢出,手工装载
; ******************************************************************************/
; void Timer0_Init ()
RSEG ?PR?Timer0_Init?TIME
Timer0_Init:
; SOURCE LINE # 10
; {
; SOURCE LINE # 11
; CKCON |= 0x04;
; SOURCE LINE # 12
ORL CKCON,#04H
; TMOD &= ~0x0f;
; SOURCE LINE # 13
ANL TMOD,#0F0H
; TMOD |= 0x01; //16位手工载入
; SOURCE LINE # 14
ORL TMOD,#01H
;
; RE_LOAD_TIME0;
; SOURCE LINE # 16
CLR A
MOV TH0,A
MOV TL0,TH0
;
; TR0=1;
; SOURCE LINE # 18
SETB TR0
; ET0=1;
; SOURCE LINE # 19
SETB ET0
;
;
; }
; SOURCE LINE # 22
RET
; END OF Timer0_Init
;
;
;
; /******************************************************************************
; ** 函数: Timer2_Init ()
; ** 入参: int counts
; ** 返回:
; ** 说明:
; ** Timer2_Init SYSCLK no Interrupt
; ** Configure Timer2 to auto-reload at interval specified by (no
; ** interrupt generated) using SYSCLK as its time base.
; ******************************************************************************/
; void Timer2_Init (int counts)
RSEG ?PR?_Timer2_Init?TIME
_Timer2_Init:
USING 0
; SOURCE LINE # 35
;---- Variable 'counts?140' assigned to Register 'R6/R7' ----
; {
; SOURCE LINE # 36
; TMR2CN = 0x00; // STOP Timer2; Clear TF2H and TF2L;
; SOURCE LINE # 37
CLR A
MOV TMR2CN,A
; // disable low-byte interrupt; disable
; // split mode; select internal timebase
; CKCON |= 0x10;
; SOURCE LINE # 40
ORL CKCON,#010H
;
; TMR2RL = -counts; // Init reload values
; SOURCE LINE # 42
CLR C
SUBB A,R7
MOV R7,A
CLR A
SUBB A,R6
MOV TMR2RL+01H,A
MOV TMR2RL,R7
; TMR2 = TMR2RL; // Init Timer2 with reload value
; SOURCE LINE # 43
MOV TMR2+01H,TMR2RL+01H
MOV TMR2,TMR2RL
; ET2 = 1; // disable Timer2 interrupts
; SOURCE LINE # 44
SETB ET2
; TR2 = 1; // start Timer2
; SOURCE LINE # 45
SETB TR2
; }
; SOURCE LINE # 46
RET
; END OF _Timer2_Init
CSEG AT 0000BH
LJMP Timer0_ISR
;
; /******************************************************************************
; ** 函数: Timer0_ISR (void) interrupt
; ** 入参:
; ** 返回:
; ** 说明: 5ms 中断
; ******************************************************************************/
; void Timer0_ISR (void) interrupt 1
RSEG ?PR?Timer0_ISR?TIME
USING 0
Timer0_ISR:
PUSH ACC
PUSH DPH
PUSH DPL
; SOURCE LINE # 54
; {
;
; PCA0CPH4 =255; //32.1ms 喂狗
; SOURCE LINE # 57
MOV PCA0CPH4,#0FFH
;
; if(wie_str)
; SOURCE LINE # 59
JNB wie_str,?C0003
; {
; SOURCE LINE # 60
; event_word |=event_wie_arrived; //当脉冲捕获开始,每次都会重载初值
; SOURCE LINE # 61
MOV DPTR,#event_word+01H
MOVX A,@DPTR
ORL A,#010H
MOVX @DPTR,A
; } //一旦溢出进入中断说明超过2ms
; SOURCE LINE # 62
?C0003:
; //没有脉冲,此时认为一帧wiegand收完
;
; RE_LOAD_TIME0;
; SOURCE LINE # 65
MOV TH0,#00H
MOV TL0,TH0
;
; }
; SOURCE LINE # 67
POP DPL
POP DPH
POP ACC
RETI
; END OF Timer0_ISR
CSEG AT 0002BH
LJMP Timer2_ISR
;
; /******************************************************************************
; ** 函数: Timer2_ISR (void) interrupt
; ** 入参:
; ** 返回:
; ** 说明: 1ms 中断
; ******************************************************************************/
; void Timer2_ISR (void) interrupt 5
RSEG ?PR?Timer2_ISR?TIME
USING 0
Timer2_ISR:
PUSH ACC
PUSH DPH
PUSH DPL
PUSH PSW
; SOURCE LINE # 75
; {
; static unsigned int count1=0;
; static unsigned int count2=0;
; static unsigned int count3=0;
; // static unsigned int count4=0;
; // static unsigned int count5=0;
;
; TF2H = 0;
; SOURCE LINE # 83
CLR TF2H
; count1++;
; SOURCE LINE # 84
MOV DPTR,#count1?341+01H
MOVX A,@DPTR
INC A
MOVX @DPTR,A
JNZ ?C0009
MOV DPTR,#count1?341
MOVX A,@DPTR
INC A
MOVX @DPTR,A
?C0009:
; count2++;
; SOURCE LINE # 85
MOV DPTR,#count2?342+01H
MOVX A,@DPTR
INC A
MOVX @DPTR,A
JNZ ?C0010
MOV DPTR,#count2?342
MOVX A,@DPTR
INC A
MOVX @DPTR,A
?C0010:
; count3++;
; SOURCE LINE # 86
MOV DPTR,#count3?343+01H
MOVX A,@DPTR
INC A
MOVX @DPTR,A
JNZ ?C0011
MOV DPTR,#count3?343
MOVX A,@DPTR
INC A
MOVX @DPTR,A
?C0011:
; // count4++;
; // count5++;
;
;
; PCA0CPH4 =255; //32.1ms 喂狗
; SOURCE LINE # 91
MOV PCA0CPH4,#0FFH
; if(count1==50)
; SOURCE LINE # 92
MOV DPTR,#count1?341
MOVX A,@DPTR
JNZ ?C0012
INC DPTR
MOVX A,@DPTR
XRL A,#032H
?C0012:
JNZ ?C0005
; {
; SOURCE LINE # 93
; count1=0;
; SOURCE LINE # 94
MOV DPTR,#count1?341
MOVX @DPTR,A
INC DPTR
MOVX @DPTR,A
; event_word |=event_uart_arrived; //50ms 查串口缓冲
; SOURCE LINE # 95
MOV DPTR,#event_word+01H
MOVX A,@DPTR
ORL A,#08H
MOVX @DPTR,A
;
; }
; SOURCE LINE # 97
?C0005:
;
; if(count2==100)
; SOURCE LINE # 99
MOV DPTR,#count2?342
MOVX A,@DPTR
JNZ ?C0013
INC DPTR
MOVX A,@DPTR
XRL A,#064H
?C0013:
JNZ ?C0006
; {
; SOURCE LINE # 100
; count2=0;
; SOURCE LINE # 101
MOV DPTR,#count2?342
MOVX @DPTR,A
INC DPTR
MOVX @DPTR,A
; event_word |=event_time_100ms; //100ms 搜索无线
; SOURCE LINE # 102
MOV DPTR,#event_word+01H
MOVX A,@DPTR
ORL A,#02H
MOVX @DPTR,A
; }
; SOURCE LINE # 103
?C0006:
;
; if(count3==1000) //1000ms 做长时间基准
; SOURCE LINE # 105
MOV DPTR,#count3?343
MOVX A,@DPTR
CJNE A,#03H,?C0008
INC DPTR
MOVX A,@DPTR
CJNE A,#0E8H,?C0008
; {
; SOURCE LINE # 106
; count3=0;
; SOURCE LINE # 107
MOV DPTR,#count3?343
CLR A
MOVX @DPTR,A
INC DPTR
MOVX @DPTR,A
; event_word |=event_time_1000ms;
; SOURCE LINE # 108
MOV DPTR,#event_word+01H
MOVX A,@DPTR
ORL A,#04H
MOVX @DPTR,A
; }
; SOURCE LINE # 109
;
;
;
;
; } ; SOURCE LINE # 114
?C0008:
POP PSW
POP DPL
POP DPH
POP ACC
RETI
; END OF Timer2_ISR
END