ADU  Series - USB Data Acquisition Interface SDK 

AduHid Quick Start Tutorial - with C

This tutorial describes a C program that communicates with an ADU device.

A Quick Start Tutorial is also available for Visual Basic.

AduHid DLL

The AduHid DLL controls an ADU USB device.

The main channel of communication between the PC and the ADU USB device is the ADU Device Pipe.

ADU Device Pipe

  • sends commands to the ADU device
  • receives responses from the ADU device


Establishing a Connection

Establish a connection between the PC and the ADU USB device by calling AduDeviceOpen.

The function returns a handle that is required in all subsequent function calls.

        HANDLE hDevice;
        hDevice = OpenAduDevice(0); 

Writing Commands

Send commands to the ADU USB device with the AduDeviceWrite function.

The example shows a query for the value of event counter 3.

        WriteAduDevice(hDevice, "RE3", 3, 0, 0);

Reading Responses

Read the response from the ADU USB device with the AduDeviceRead function.

The example shows the results for the preceding event counter query.

        char sBuffer[8];
        memset(sBuffer, 0, sizeof(sBuffer));
        ReadAduDevice(hDevice, sBuffer, 7, 0, 0);

After the ReadAduDevice function finishes the sBuffer contains the value of the third event counter

(eg 00027 if 27 events have occurred).

Closing the Connection

Close the connection to the ADU USB device with the AduDeviceClose function.

        CloseAduDevice(hDevice);

Header File

The AduHid functions are declared in the AduHid.h header file.

    #include "AduHid.h"

Minimal C Program

Here is a simple program that assumes no error conditions occur.

    #include "AduHid.h"
    #include "stdio.h"  /* for the printf function */

    int main(int argc, char* argv[])
    {
        void * hDevice;
        char sBuffer[8];

        hDevice = OpenAduDevice(0); 
        WriteAduDevice(hDevice, "RE3", 3, 0, 0);
        memset(sBuffer, 0, sizeof(sBuffer));
        ReadAduDevice(hDevice, sBuffer, 7, 0, 0);
        CloseAduDevice(hDevice);
        printf("The third event counter is %s\n", sBuffer);
        return 0;
    }

When this program is run in a DOS command window the value of the third event counter is printed on the screen.

Additional Checks

A production program requires checks to ensure correct operation. Read the other pages on this web site for more information.

Compiling the Example

Not everyone is conversant with compilers so here are some detailed instructions: