# SendConfiguration Method - neoVI API

This method sends configuration information to the hardware.

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

```cpp
int _stdcall icsneoSendConfiguration(int hObject, unsigned char *pData, int lNumBytes);
```

{% endtab %}

{% tab title="C# Declare" %}

```csharp
[DllImport("icsneo40.dll")]
public static extern Int32 icsneoSetFireSettings(Int32 hObject, ref SFireSettings pSettings, Int32 iNumBytes, Int32 bSaveToEEPROM);
```

{% endtab %}

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

```vbnet
Public Declare Function icsneoSendConfiguration Lib “icsneo40.dll” (ByVal hObject As Int32, ByRef pData As Byte, ByVal lNumBytes As Int32) As Int32
```

{% 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).

pData

\[in] This is an array configuration bytes. The format of this array is defined in the Configuration Array help topic. This data should be filled in with a call to [GetConfiguration](/neovi-api/win32-api-overview-intrepidcs-api/device-settings-functions-overview-intrepidcs-api/getconfiguration-method-intrepidcs-api.md) before calling SendConfiguration. The size of this array must always be 1024 bytes.

lNumBytes

\[in] This must always be set to 1024.

**Return Values**

Returns 1 if successful, 0 if an error occurred. [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\_NEOVI\_NO\_RESPONSE = 75

**Remarks**

This method will only update the configuration defined in the Configuration Array topic. It will also apply checking to the data so that a neoVI is not programmed to an illegal state. For example, setting the CAN controller to an illegal operating mode.

### Examples

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

```cpp
unsigned char bConfigBytes[1024];
int iNumConfigBytes = 1024;

if(m_bPortOpen)
{
   lResult = icsneoGetConfiguration(hObject, bConfigBytes, &iNumConfigBytes);
   if (lResult == 0)
       MessageBox(hWnd,TEXT("Problem Reading Configuration"),TEXT("neoVI Example"),0);
   else
   {
       iOldCNF1=bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF1];
       iOldCNF2=bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF2];
       iOldCNF3=bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF3];


       // 250 K for Value CAN 500k for neoVI (neoVI and valuecan use different CAN controller rates)
       bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF1] = 0x03;
       bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF2] = 0xB8;
       bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF3] = 0x05;

       lResult = icsneoSendConfiguration(hObject, bConfigBytes, iNumConfigBytes);

       if (lResult == 0)
           MessageBox(hWnd,TEXT("Problem Updating Configuration"),TEXT("neoVI Example"),0);
        else
       {
           wsprintf(szOut,TEXT("Old Values: HSCAN CNF1 = %x HSCAN CNF2 = %x HSCAN CNF3 = %x \n\nNew Values HSCAN CNF1 = %x HSCAN CNF2 = %x HSCAN CNF3 = %x "),
           iOldCNF1,
           iOldCNF2,
           iOldCNF3,
           bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF1],
           bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF2],
           bConfigBytes[NEO_CFG_MPIC_HS_CAN_CNF3]);
           MessageBox(hWnd,szOut,TEXT("neoVI Example"),0);
       }
   }
}
else
   MessageBox(hWnd,TEXT("Port Not Open"),TEXT("neoVI Example"),0);
```

{% endtab %}

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

```vbnet
Dim bConfigBytes(1024) As Byte ''Storage for Data bytes from device
Dim iNumBytes As Integer ''Storage for Number of Bytes
Dim lResult As Integer ''Storage for Result of Called Function
Dim Counter As Integer
Dim iNumberOfErrors As Long ''Storage for Number of Errors Received

''Clear ListBox
lstConfigInformation.Items.Clear()
''Call Get Configuration
lResult = icsneoGetConfiguration(m_hObject, bConfigBytes(0), iNumBytes)
''Fill Listbox with Data From Function Call
For Counter = 0 To 1024
   lstConfigInformation.Items.Add("Byte Number-" & Counter & " Byte Data-" & bConfigBytes(Counter))
Next Counter

'/---------------------READ CONFIGURATION -----------------------------------------------

''Set HS CAN Baud Rate Information
bConfigBytes(NEO_CFG_MPIC_HS_CAN_CNF1) = Val("&H" & txtCNF1.Text)
bConfigBytes(NEO_CFG_MPIC_HS_CAN_CNF2) = Val("&H" & txtCNF2.Text)
bConfigBytes(NEO_CFG_MPIC_HS_CAN_CNF3) = Val("&H" & txtCNF3.Text)

'/---------------------SEND CONFIGURATION -----------------------------------------------
''Call Sned configuration
lResult = icsneoSendConfiguration(m_hObject, bConfigBytes(0), iNumBytes)

'// make sure the read was successful
If Not CBool(lResult) Then
   MsgBox("Problem sending configuration")
   lResult = icsneoClosePort(m_hObject, iNumberOfErrors)
   Exit Sub
Else
   MsgBox("Configuration Successfull")
End If
```

{% endtab %}

{% tab title="C# Example" %}

```csharp
byte[] bConfigBytes= new byte[1024]; //Storage for Data bytes from device
int iNumBytes = 0; //Storage for Number of Bytes
int lResult = 0; //Storage for Result of Called Function
int Counter;
int lNumberOfErrors = 0; //Storage for Number of Errors Received

//Clear ListBox
lstConfigInformation.Items.Clear();

//---------------------READ CONFIGURATION -----------------------------------------------

//Call Get Configuration
lResult = icsNeoDll.icsneoGetConfiguration(m_hObject, ref bConfigBytes[0],ref iNumBytes);

//Fill Listbox with Data From Function Call
for(Counter=0; Counter<1024;Counter++)
{
   lstConfigInformation.Items.Add("Byte Number-" + Counter + " Byte Data-" + bConfigBytes[Counter]);
}

//Set HS CAN Baud Rate Information
bConfigBytes[Convert.ToInt32(icsConfigSetup.NEO_CFG_MPIC_HS_CAN_CNF1)] = Convert.ToByte(ConvertFromHex(txtCNF1.Text));
bConfigBytes[Convert.ToInt32(icsConfigSetup.NEO_CFG_MPIC_HS_CAN_CNF2)] = Convert.ToByte(ConvertFromHex(txtCNF2.Text));
bConfigBytes[Convert.ToInt32(icsConfigSetup.NEO_CFG_MPIC_HS_CAN_CNF3)] = Convert.ToByte(ConvertFromHex(txtCNF3.Text));

//---------------------SEND CONFIGURATION -----------------------------------------------
//Call Sned configuration
lResult = icsNeoDll.icsneoSendConfiguration(m_hObject, ref bConfigBytes[0], iNumBytes);

// make sure the read was successful
if(lResult==0)
{
   MessageBox.Show("Problem sending configuration");
   lResult = icsNeoDll.icsneoClosePort(m_hObject, ref lNumberOfErrors);
}
else
{
   MessageBox.Show("Configuration Successfull");
}
```

{% 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/sendconfiguration-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.
