4.1.10 CAN_Config
Description:
Configure CAN controller. After calling this function, the CAN controller
will enter operating mode.
Syntax:
int CAN_Config(BYTE BoardNo, BYTE Port,ConfigStruct *CanConfig);
Parameter:
BoardNo: [input] PISO-CAN board number (0~7).
Port: [input] CAN port number (1~8)
*ConfigStruct: [input] The point of structure for ConfigStruct is defined as
following,
typedef struct config
{
BYTE
AccCode[4];
BYTE
AccMask[4];
BYTE
BaudRate;
BYTE BT0, BT1;
} ConfigStruct;
AccCode[4]: Acceptance code for CAN controller.
AccMask[4]: Acceptance mask for CAN controller.
BaudRate: 0
→
user-defined(must to set BT0,BT1), 1
→
10Kbps,
2
→
20Kbps, 3
→
50Kbps, 4
→
125Kbps, 5
→
250Kbps,
6
→
500Kbps, 7
→
800Kbps, 8
→
1Mbps.
BT0, BT1: user-defined baud rate (used only if BaudRate=0)). For
example, BT0=0x04, BT1=0x1C, then baud rate setting for
the CAN controller is 100Kbps. For more detail baud rate
setting, please refer to manual of SJA1000 CAN controller.
Return:
CAN_NoError: OK
CAN_DriverError: Kernel driver can’t be opened.
CAN_BoardNumberError: BoardNo is not correct or exceeds the current
total board number.
PISO-CAN/PEX-CAN/PCM-CAN Series User’s Manual (v2.6 Dec/2013) -------
42
CAN_PortNumberError: Port number is not correct.
CAN_ActiveBoardError: This board is not activated.
ГК
Атлант
Инжиниринг
–
официальный
представитель
в
РФ
и
СНГ
+7(495)109-02-08 [email protected] www.bbrc.ru