Software
SYS TEC electronic GmbH 2001 L-487e_6
59
3.2.4
Baud Rate Configuration
The baud rate configuration is transferred to the function
UcanInitCan () as parameter bBTR0_p and bBTR1_p. The
configuration can also be changed later by calling the function
UcanSetBaudrate (). The following values are recommended:
USBCAN_BAUD_10kBit: 0x672f // CAN baud rate 10 kBit/s
USBCAN_BAUD_20kBit: 0x532f // CAN baud rate 20 kBit/s
USBCAN_BAUD_50kBit: 0x472f // CAN baud rate 50 kBit/s
USBCAN_BAUD_100kBit: 0x432f // CAN baud rate 100 kBit/s
USBCAN_BAUD_125kBit: 0x031c // CAN baud rate 125 kBit/s
USBCAN_BAUD_250kBit: 0x011c // CAN baud rate 250 kBit/s
USBCAN_BAUD_500kBit: 0x001c // CAN baud rate 500 kBit/s
USBCAN_BAUD_800kBit: 0x0016 // CAN baud rate 800 kBit/s
USBCAN_BAUD_1MBit: 0x0014 // CAN baud rate 1 MBit/s
Example:
TUcanHandle UcanHandle;
BYTE bRet;
...
// initializes the hardware
bRet = UcanInitHardware (&UcanHandle, 0, NULL);
...
// initializes the CAN interface
bRet = UcanInitCan (UcanHandle,
HIBYTE (USBCAN_BAUD_1MBit), // BTR0 for 1MBit/s
LOBYTE (USBCAN_BAUD_1MBit), // BTR1 for 1MBit/s
0xffff, // AMR: all messages received
0x0000); // ACR
// Error? print error
if (bRet) PrintError (bRet);
...
Configuration of other baud rates is also possible. Refer to the
SJA1000 Data Sheet for detailed description.