Get the CAN communication timing settings.
Ret = CanGetCanTiming ( Id , ChannelNo , Bitrate , TSeg1 , SJW , TSeg2 )
Id
[ C: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CanInit.
ChannelNo
[ C: unsigned short ] [ Python: ctypes.c_ushort ]
Specify the channel number.
Bitrate
[ C: unsigned int * ] [ Python: ctypes.POINTER(ctypes.c_uint) ]
Get the bitrate. The unit is bps. (bit per second)
TSeg1 [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the time segment 1. The unit is TQ.
SJW [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the SJW. The unit is TQ.
TSeg2 [
C: unsigned short * ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Get the time segment 2. The unit is TQ.
Ret [ C: long ] [ Python: ctypes.c_long ]
Definition |
Value |
Description |
CAN_ERR_SUCCESS |
0 |
Normality completion |
CAN_ERR_DLL_INVALID_ID |
10001 |
Invalid ID specified. |
CAN_ERR_DLL_CALL_DRIVER |
10002 |
Driver can't be called (Failed in the ioctl). |
CAN_ERR_DLL_BUFF_ADDRESS |
10100 |
Invalid data buffer address. |
CAN_ERR_SYS_CH_NO |
20101 |
Channel number is outside the settable range |
The others (See also: Details of Error Code)
None
Get the CAN communication timing settings.
It can be used even when connected to CAN bus.
For details, please refer to CAN communication transmission time.
Get Bitrate, TSeg1, SJW, TSeg2 set to ChannelNo = 1.
C |
long Ret; unsigned int Bitrate; unsigned short TSeg1; unsigned short SJW; unsigned short TSeg2; |
Python |
Ret = ctypes.c_long() Bitrate = ctypes.ctypes.c_uint() TSeg1 = ctypes.c_ushort() SJW = ctypes.c_ushort() TSeg2 = ctypes.c_ushort()
|