USB-CANmodul
62
SYS TEC electronic GmbH 2001 L-487e_6
Example:
TUcanHandle UcanHandle;
BYTE bRet;
...
// initializes the hardware
bRet = UcanInitHardware (&UcanHandle, 0, NULL);
...
// initializes the CAN interface
// filters 11-bit CAN messages with ID 0x300 to 0x3ff,
// RTR unimportant
bRet = UcanInitCan (UcanHandle,
HIBYTE (USBCAN_BAUD_1MBit),
LOBYTE (USBCAN_BAUD_1MBit),
USBCAN_SET_AMR (FALSE, 0x0ff, 1),
USBCAN_SET_ACR (FALSE, 0x300, 0));
// Error? print error
if (bRet) PrintError (bRet);
...
CAN messages with a 29-bit identifier are filtered with the same
configuration. In this case AMR and ACR are interpreted in a
different way. In this configuration, CAN messages with the 29-bit
identifiers from 0x0C000000 to 0FFFFFFF will be received.