This method sets bit rates for networks on neoVI devices
{% tabs %} {% tab title="C/C++ Declare" %}
int _stdcall icsneoSetBitRate(void * hObject, int iBitRate, int iNetworkID);
{% endtab %}
{% tab title="Visual Basic .NET Declare" %}
Public Declare Function icsneoSetBitRate Lib “icsneo40.dll” (ByVal hObject As IntPtr, ByVal BitRate As Int32, ByVal NetworkID As Int32) As Int32
{% endtab %}
{% tab title="C# Declare" %}
[DllImport(“icsneo40.dll”)] public static extern Int32 icsneoSetBitRate(IntPtr hObject, Int32 BitRate, Int32 NetworkID);
{% endtab %} {% endtabs %}
Parameters
hObject
[in] Specifies the driver object created by OpenNeoDevice.
iBitRate
[in] Specifies bit rate setting. Valid values depend on the network specified.
For the networks NETID_HSCAN, NETID_MSCAN, NETID_SWCAN, NETID_FIRE_HSCAN2, NETID_HSCAN3, NETID_LSFTCAN, valid bit rates are 2000, 33333, 50000, 62500, 83333, 100000, 125000, 250000, 500000, 800000, 1000000
For the networks NETID_LIN, NETID_ISO2, NETID_FIRE_LIN2, NETID_FIRE_LIN3, NETID_FIRE_LIN4, valid bit rates are
For the network NETID_FIRE_CGI valid bit rates are 625000 and 115200
iNetworkID
[in] Specifies the network. The valid values are:
NETID_HSCAN, NETID_MSCAN, NETID_SWCAN, NETID_FIRE_HSCAN2, NETID_HSCAN3, NETID_LSFTCAN, NETID_LIN, NETID_ISO2, NETID_FIRE_LIN2, NETID_FIRE_LIN3, NETID_FIRE_LIN4, NETID_FIRE_CGI
These values are defined in the icsnVC40.h file
Return Values
1 if the function succeeded. 0 if it failed for any reason. GetLastAPIError must be called to obtain the specific error. The errors that can be generated by this function are:
NEOVI_ERROR_DLL_INVALID_NETID = 8
NEOVI_ERROR_DLL_NEOVI_NO_RESPONSE = 75
NEOVI_ERROR_DLL_RED_INVALID_BAUD_SPECIFIED = 122
NEOVI_ERROR_DLL_SEND_DEVICE_CONFIG_ERROR = 229
NEOVI_ERROR_DLL_GET_DEVICE_CONFIG_ERROR = 230
NEOVI_ERROR_DLL_UNKNOWN_NEOVI_TYPE = 231
Remarks
The specified network must exist on the connected neoVI device.
{% tabs %} {% tab title="C/C++ Example:" %}
int iRetVal;
iRetVal = icsneoSetBitrate(hObject, 500000, NETID_HSCAN);
if(iRetVal == 0)
{
printf("\nFailed to set the bit rate");
}
else
{
printf("\nSuccessfully set the bit rate");
}
{% endtab %}
{% tab title="C# Example:" %}
int iResult;
//Set the bit rate
iResult = icsNeoDll.icsneoSetBitRate(m_hObject, 500000, NETID_HSCAN);
if (iResult == 0)
{
MessageBox.Show("Problem setting bit rate");
}
{% endtab %}
{% tab title="Visual Basic .NET Example:" %}
Dim iResult As Integer
'//Set the bit rate
iResult = icsneoSetBitRate(m_hObject, 500000, NETID_HSCAN)
If (iResult = 0) Then MsgBox("Problem setting bit rate")
{% endtab %} {% endtabs %}