I haven't used the PIC18F4580, but if you look into the datasheet of newer devices with CAN (i.e. PIC18F66K80 and PIC18F26K83), ERRIF is defined as: ERRIF
: Error Interrupt Flag bit (Multiple sources in COMSTAT register)
1 = An error has occurred in the CAN module (multiple sources)
0 = No CAN Module errors
This means that ERRIF is set when any of the COMSTAT error bits is set (provided that the ERRIE bit is enabled).
On the other hand, IRXIF
: CAN Bus Error Message Received Interrupt Flag bit
1 = An invalid message has occurred on the CAN bus
0 = No invalid message on the CAN bus
The IRXIF will only be set whenever an invalid message
is detected during transmit or receive (provided that IRXIE bit is enabled). This is different with ERRIF which is set whenever an overflow, bus-off, bus passive, or a warning condition occurs (refer to COMSTAT).
Hope this helps. :)
post edited by tam07 - 2019/04/10 04:44:24