# SetBitRate Method - neoVI API

This method sets bit rates for networks on neoVI devices

{% tabs %}
{% tab title="C/C++ Declare" %}

```cpp
int _stdcall icsneoSetBitRate(void * hObject, int iBitRate, int iNetworkID);
```

{% endtab %}

{% tab title="Visual Basic .NET Declare" %}

```vbnet
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" %}

```csharp
[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](/neovi-api/win32-api-overview-intrepidcs-api/basic-functions-overview-intrepidcs-api/openneodevice-method-intrepidcs-api.md).

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](/neovi-api/win32-api-overview-intrepidcs-api/error-functions-overview-intrepidcs-api/getlastapierror-method-intrepidcs-api.md) 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.

### Examples

{% tabs %}
{% tab title="C/C++ Example:" %}

```cpp
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:" %}

```csharp
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:" %}

```vbnet
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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.intrepidcs.com/neovi-api/win32-api-overview-intrepidcs-api/device-settings-functions-overview-intrepidcs-api/general-device-settings-intrepidcs-api/setbitrate-method-intrepidcs-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
