English
Language : 

PIC18F6585 Datasheet, PDF (345/496 Pages) Microchip Technology – 64/68/80-Pin High-Performance, 64-Kbyte Enhanced Flash Microcontrollers with ECAN Module
PIC18F6585/8585/6680/8680
23.15.2 TRANSMIT INTERRUPT
When the transmit interrupt is enabled, an interrupt will
be generated when the associated transmit buffer
becomes empty and is ready to be loaded with a new
message. In Mode 0, there are separate interrupt
enable/disable and flag bits for each of the three
dedicated transmit buffers. The TXBnIF bit will be set to
indicate the source of the interrupt. The interrupt is
cleared by the MCU resetting the TXBnIF bit to a ‘0’. In
Mode 1 and 2, all transmit buffers share one interrupt
enable/disable and flag bits. In Mode 1 and 2, TXBIE in
PIE3 and TXBIF in PIR3 indicate when a transmit buffer
has completed transmission of its message. TXBnIF,
TXBnIE and TXBnIP in PIR3, PIE3 and IPR3, respec-
tively, are not used in Mode 1 and 2. Individual transmit
buffer interrupts can be enabled or disabled by setting or
clearing TXBIE and BnIE register bits. When a shared
interrupt occurs, user firmware must poll the TXREQ bit
of all transmit buffers to detect the source of interrupt.
23.15.3 RECEIVE INTERRUPT
When the receive interrupt is enabled, an interrupt will
be generated when a message has been successfully
received and loaded into the associated receive buffer.
This interrupt is activated immediately after receiving
the End Of Frame (EOF) field.
In Mode 0, the RXBnIF bit is set to indicate the source
of the interrupt. The interrupt is cleared by the MCU
resetting the RXBnIF bit to a ‘0’.
In Mode 1 and 2, all receive buffers share one interrupt.
Individual receive buffer interrupts can be controlled by
the RXBnIE and BIEn registers. In Mode 1, when a
shared receive interrupt occurs, user firmware must
poll the RXFUL bit of each receive buffer to detect the
source of interrupt. In Mode 2, a receive interrupt
indicates that the new message is loaded into FIFO.
FIFO can be read by using FIFO pointer bits, FP.
In Mode 2, the FIFOWMIF bit indicates if the FIFO high
watermark is reached. The FIFO high watermark is
defined by the FIFOWM bit in the ECANCON register.
23.15.4 MESSAGE ERROR INTERRUPT
When an error occurs during transmission or reception
of a message, the message error flag, IRXIF, will be set
and if the IRXIE bit is set, an interrupt will be generated.
This is intended to be used to facilitate baud rate
determination when used in conjunction with Listen
Only mode.
23.15.5 BUS ACTIVITY WAKE-UP
INTERRUPT
When the PIC18F6585/8585/6680/8680 devices are in
Sleep mode and the bus activity wake-up interrupt is
enabled, an interrupt will be generated and the WAKIF
bit will be set when activity is detected on the CAN bus.
This interrupt causes the PIC18F6585/8585/6680/
8680 devices to exit Sleep mode. The interrupt is reset
by the MCU, clearing the WAKIF bit.
23.15.6 ERROR INTERRUPT
When the error interrupt is enabled, an interrupt is
generated if an overflow condition occurs or if the error
state of the transmitter or receiver has changed. The
error flags in COMSTAT will indicate one of the
following conditions.
23.15.6.1 Receiver Overflow
An overflow condition occurs when the MAB has
assembled a valid received message (the message
meets the criteria of the acceptance filters) and the
receive buffer associated with the filter is not available
for loading of a new message. The associated
COMSTAT.RXnOVFL bit will be set to indicate the
overflow condition. This bit must be cleared by the
MCU.
23.15.6.2 Receiver Warning
The receive error counter has reached the MCU
warning limit of 96.
23.15.6.3 Transmitter Warning
The transmit error counter has reached the MCU
warning limit of 96.
23.15.6.4 Receiver Bus Passive
The receive error counter has exceeded the error-
passive limit of 127 and the device has gone to
error-passive state.
23.15.6.5 Transmitter Bus Passive
The transmit error counter has exceeded the error-
passive limit of 127 and the device has gone to
error-passive state.
23.15.6.6 Bus-Off
The transmit error counter has exceeded 255 and the
device has gone to bus-off state.
23.15.6.7 Interrupt Acknowledge
Interrupts are directly associated with one or more sta-
tus flags in the PIR register. Interrupts are pending as
long as one of the flags is set. Once an interrupt flag is
set by the device, the flag can not be reset by the
microcontroller until the interrupt condition is removed.
 2004 Microchip Technology Inc.
DS30491C-page 343