English
Language : 

PIC18F6585 Datasheet, PDF (298/496 Pages) Microchip Technology – 64/68/80-Pin High-Performance, 64-Kbyte Enhanced Flash Microcontrollers with ECAN Module
PIC18F6585/8585/6680/8680
REGISTER 23-20: RXBnDm: RECEIVE BUFFER n DATA FIELD BYTE m REGISTERS
[0 ≤ n ≤ 1, 0 ≤ m ≤ 7]
R-x
R-x
R-x
R-x
R-x
R-x
R-x
R-x
RXBnDm7 RXBnDm6 RXBnDm5 RXBnDm4 RXBnDm3 RXBnDm2 RXBnDm1 RXBnDm0
bit 7
bit 0
bit 7-0
RXBnDm7:RXBnDm0: Receive Buffer n Data Field Byte m bits (where 0 ≤ n < 1 and 0 < m < 7)
Each receive buffer has an array of registers. For example, Receive Buffer 0 has 8 registers:
RXB0D0 to RXB0D7.
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
REGISTER 23-21: RXERRCNT: RECEIVE ERROR COUNT REGISTER
R-0
R-0
R-0
R-0
R-0
REC7
REC6
REC5
REC4
REC3
bit 7
R-0
REC2
R-0
REC1
R-0
REC0
bit 0
bit 7-0
REC7:REC0: 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.
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
EXAMPLE 23-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.
...
DS30491C-page 296
 2004 Microchip Technology Inc.