GET_RXD_RF
;결과값1:W<-1,0(1:정상,0:에러)
;결과값2:RXD_RF_MODE
;결과값3:RXD_RF_PERIOD
;결과값4:RXD_RF_ID1
;결과값5:RXD_RF_ID2
;결과값6:RXD_RF_ID3
;결과값7:RXD_RF_ID4
;결과값8:RXD_RF_CHKSUM
CALL START_TMR0_8US
BTFSC INTCON,T0IF
RETLW .0;에러
BTFSS TXD;싱크헤드시작지점찾기위해H체크
GOTO $-3;현위치에서 3칸 위로 돌아가라(BTFSC INTCON,T0IF 지점으로 이동)
CHK_SYNCHEAD_START;┐싱크헤드시작지점하강에지찾음
CALL START_TMR0_8US;2048US동안
BTFSC INTCON,T0IF
RETLW .0;에러
BTFSC TXD
GOTO $-3
CHK_SYNCHEAD_TIME;└────┘싱크헤드구간측정
CALL START_TMR0_8US
BTFSC INTCON,T0IF
RETLW .0;에러
BTFSS TXD
GOTO $-3
MOVF TMR0,W
MOVWF BUF_TMR0
MOVLW .188
SUBWF BUF_TMR0,W
BTFSS STATUS,CF;1500US보다짧으면에러
RETLW .0;에러
MOVLW .250
SUBWF BUF_TMR0,W
BTFSC STATUS,CF;2000US보다길면에러
RETLW .0;에러
CHK_STARTBIT_H;스타트비트H구간시간체크 ┌┐
CALL START_TMR0_4US
BTFSC INTCON,T0IF
RETLW .0;에러
BTFSC TXD
GOTO $-3
MOVF TMR0,W
MOVWF BUF_TMR0
MOVLW .50;60
SUBWF BUF_TMR0,W
BTFSS STATUS,CF;240US보다짧으면에러
RETLW .0;에러
MOVLW .150;125
SUBWF BUF_TMR0,W
BTFSC STATUS,CF;600US보다길면에러
RETLW .0;에러
MOVLW RXD_RF_MODE
MOVWF FSR
CALL DELAY_500US
CHK_EDGE_RXD_RF
CLRF INDF
CLRF CNT_UNI
MOVLW .8
MOVWF CNT_UNI
CHK_EDGE_RXD_RF2
CALL START_TMR0_4US
BTFSC TXD
GOTO CHK_DOWNEDGE
CHK_UPEDGE
BTFSC INTCON,T0IF
RETLW .0;에러
BTFSS TXD
GOTO $-3
MOVF TMR0,W
MOVWF BUF_TMR0
MOVLW .250;150
SUBWF BUF_TMR0,W
BTFSC STATUS,CF;600US보다길면에러
RETLW .0;에러
CALL DELAY_500US
BCF STATUS,CF
GOTO GET1BYTE_RXD_RF
CHK_DOWNEDGE
BTFSC INTCON,T0IF
RETLW .0;에러
BTFSC TXD
GOTO $-3
MOVF TMR0,W
MOVWF BUF_TMR0
MOVLW .200;150
SUBWF BUF_TMR0,W
BTFSC STATUS,CF;600US보다길면에러
RETLW .0;에러
CALL DELAY_600US
BSF STATUS,CF
GET1BYTE_RXD_RF
RRF INDF
DECFSZ CNT_UNI
GOTO CHK_EDGE_RXD_RF2
INCF FSR
MOVLW 0x68;TEST
XORWF FSR, W
BTFSS STATUS, ZF
GOTO CHK_EDGE_RXD_RF
RETLW .1
'초보의 아웅다웅 설계하기 > PIC' 카테고리의 다른 글
8. TMR0 설정하기. (0) | 2010.08.02 |
---|---|
7. 내부 EEPROM 사용하기 (0) | 2010.08.02 |
5. TMR 사용하기. (0) | 2010.08.02 |
4. 내부 풀업 사용하기 (0) | 2010.08.02 |
3. PCL을 사용하는 데이터테이블 사용시 주의점. (0) | 2010.08.02 |