CanGetCanTiming


Function

Get the CAN communication timing settings.

Format

Ret = CanGetCanTiming ( Id , ChannelNo , Bitrate , TSeg1 , SJW , TSeg2 )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ]
Specify the device ID retrieved from CanInit.

ChannelNo [ VB.NET: UShort ] [ C, C++: unsigned short ] [ C#: ushort ]
Specify the channel number.

Bitrate [ VB.NET: UInteger ] [ C, C++: unsigned long * ] [ C#: out uint ]
Get the bitrate. The unit is bps. (bit per second)

TSeg1 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ]
Get the time segment 1. The unit is TQ.

SJW [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ]
Get the SJW. The unit is TQ.

TSeg2 [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ]
Get the time segment 2. The unit is TQ.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ]

Definition

Value
[Dec]

Description

CAN_ERR_SUCCESS

0

Normality completion

CAN_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute CanResetDevice function because the device has recovered from standby mode.

CAN_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

CAN_ERR_DLL_CALL_DRIVER

10002

Driver can't be called (Failed in the device I/O control).

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)

Initial Value

None

Remarks

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.

Example

Get Bitrate, TSeg1, SJW, TSeg2 set to ChannelNo = 1.

VB.NET

Dim Ret As Integer

Dim Bitrate As UInteger

Dim TSeg1 As UShort

Dim SJW As UShort

Dim TSeg2 As UShort

Ret = CanSetCanTiming ( Id , 1 , Bitrate , TSeg1 , SJW , TSeg2 )
 

C, C++

long Ret;

unsigned long Bitrate;

unsigned short TSeg1;

unsigned short SJW;

unsigned short TSeg2;
Ret = CanSetCanTiming ( Id , 1 , &Bitrate , &TSeg1 , &SJW , &TSeg2 );
 

C#

int Ret;

ulong Bitrate;

ushort TSeg1;

ushort SJW;

ushort TSeg2;
Ret = can.SetCanTiming ( Id , 1 , out Bitrate , out TSeg1 , out SJW , out TSeg2 );
 

See Also

CanSetCanTiming