Candetectbaudrate() – ADLINK PCI-7841/cPCI-7841 User Manual
Page 31
Function Reference
23
CanCloseDriver(handle);
CanDetectBaudrate()
Purpose
Perform auto-detect baud rate algorithm.
Prototype
C/C++
int CanDetectBaudrate(int handle, int
miliSecs)
Parameters
handle: handle retrieve from CanOpen-
Driver()
MiliSecs: timeout time(ms)
Return Value
Return –1 if error occurs
Others is the baudrate
Remarks
Call this function to detect the baud rate of
a port.
The function performs an algorithm to
detect your baud rate. It needs that there
are activities on the network. And it will
return a –1 when detecting no activity on
the network or time was exceeded.
See Also
none
Usage
C/C++
#include “pci7841.h
PORT_STRUCT port_struct;”
int handle = CanOpenDriver();
port_struct.mode = 0;//CAN2.0A (11-bit CAN id)
port_struct.accCode = 0;//This setting of
acceptance code and
port_struct.accMask = 0x7FF;//mask enable all
MAC_IDs input
port_struct.baudrate = CanDetectBaudrate(handle,
1000):
Value Baudrate
0
125 Kbps
1
250 Kbps
2
500 Kbps
3
1 Mbps