I-7188XBD-CAN/μPAC-7186EXD-CAN user manual (ver.1.0.3, May/09/2014)
45
3.1.21 UserCANInt
Description:
This function is created by users and is used to program the CAN
interrupt service routine by users. The parameter CANINT is passed
automatically when the interrupt functions are triggered. It indicates
what kinds of CAN controller interrupt are active. Therefore, users only
need to design their interrupt routine according to dealing with different
interrupt functions. If it is not used, please reverse this function in the
users’ .C file for avoiding the complier error. The following figure is the
general concept of the function UserCANInt.
...
UserCANInt(CANInt);
...
interrupt routine
...
CAN_Config(&ConfigInfo);
...
...
CAN_Restore();
main program
When i nt errupt s are
triggered, the interrupt
routine will be inplemented
The types of interrupt
function are passed into the
function UserInterrupt
void UserCANInt(char CANInt)
{
...
switch (CANInt)
{
...
}
...
}
Use switch function or other
methods to design the action
based on different types of
interrupt.
user-defined function
pr ogr am r unni ng
sequence
Syntax:
void UserCANInt(char CANInt)
Parameter:
CANInt: The interrupt service routine will bypass the CANInt
parameter to users to indicate what interrupt is triggered. For the
meanings of CANInt parameters, please refer to the following table.
CANIntMode Value (Hex)
Meaning
0x01
Receive a message successfully
0x02
Transmit a message successfully
0x04
Error warring
0x08
Data Overrun