Download Hardware Manual

Transcript
Software Support for Windows OS
Example 1:
tUcanHandle UcanHandle;
UCANRET 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 != USBCAN_SUCCESSFUL)
PrintError (bRet);
...
If, according to example 1, the CAN-controller receives a CAN-message with 29-bit
identifier, then it is filtered with the same configuration. However, AMR and ACR are
interpreted differently. Here, CAN-messages with 29-bit identifiers from 0x0C000000 to
0FFFFFFF are received too.
Example 2:
tUcanHandle UcanHandle;
UCANRET bRet;
...
// initializes the hardware
bRet = UcanInitHardware (&UcanHandle, 0, NULL);
// initializes the CAN-interface
// filters 11-bit CAN-messages with ID 0x600 to 0x67F,
// RTR-Frames unimportant
bRet = UcanInitCan (UcanHandle,
HIBYTE (USBCAN_BAUD_1MBit),
LOBYTE (USBCAN_BAUD_1MBit),
USBCAN_CALCULATE_AMR (FALSE, 0x600, 0x67F, FALSE, FALSE),
USBCAN_CALCULATE_ACR (FALSE, 0x600, 0x67F, FALSE, FALSE));
// error? Print error
if (bRet != USBCAN_SUCCESSFUL)
PrintError (bRet);
...
Filter parameters for RTR frames and the first two data bytes are ignored with all
sysWORXX modules.
 SYS TEC electronic GmbH 2010
L-487e_22
137