English
Language : 

PIC18F45K80-I Datasheet, PDF (412/622 Pages) Microchip Technology – 28/40/44/64-Pin, Enhanced Flash Microcontrollers with ECAN and nanoWatt XLP Technology
PIC18F66K80 FAMILY
REGISTER 27-21: RXERRCNT: RECEIVE ERROR COUNT REGISTER
R-0
REC7
bit 7
R-0
REC6
R-0
REC5
R-0
REC4
R-0
REC3
R-0
REC2
R-0
REC1
R-0
REC0
bit 0
Legend:
R = Readable bit
-n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared
x = Bit is unknown
bit 7-0
REC<7:0>: Receive Error Counter bits
This register contains the receive error value as defined by the CAN specifications. When
RXERRCNT > 127, the module will go into an error-passive state. RXERRCNT does not have the
ability to put the module in “bus-off” state.
EXAMPLE 27-5: READING A CAN MESSAGE
; Need to read a pending message from RXB0 buffer.
; To receive any message, filter, mask and RXM1:RXM0 bits in RXB0CON registers must be
; programmed correctly.
;
; Make sure that there is a message pending in RXB0.
BTFSS RXB0CON, RXFUL
; Does RXB0 contain a message?
BRA
NoMessage
; No. Handle this situation...
; We have verified that a message is pending in RXB0 buffer.
; If this buffer can receive both Standard or Extended Identifier messages,
; identify type of message received.
BTFSS RXB0SIDL, EXID
; Is this Extended Identifier?
BRA
StandardMessage
; No. This is Standard Identifier message.
; Yes. This is Extended Identifier message.
; Read all 29-bits of Extended Identifier message.
...
; Now read all data bytes
MOVFF RXB0DO, MY_DATA_BYTE1
...
; Once entire message is read, mark the RXB0 that it is read and no longer FULL.
BCF
RXB0CON, RXFUL
; This will allow CAN Module to load new messages
; into this buffer.
...
DS39977F-page 412
 2010-2012 Microchip Technology Inc.