You are here

Introduction

USB-I/O Interface Adapter GPIO-24 allows to connect various hardware devices to your PC. Easy installation and plug-and-play support makes GPIO-24 adapter an ideal solution to add USB interface to your HW.

The adapter provides both analog and digital input/output capabilities to any computer with USB port. GPIO-24 adapter serves the needs of automation engineering, various devices monitoring, retrieving industrial process information or lab measurement data.

Any of 24 I/O pins can be configured to accept inputs, to drive outputs, to send continuous low or high frequency PWM signals or to send single pulses.

You can configure pins in input mode to notify PC software when the input signal level is changed. To avoid contact bounce, signal level is accepted after it has been stable for a predefined period of time.

In PWM mode each contact can be independently configured to send square waves with predefined high and low signal periods. Periods can vary from 1 ms up to 65 seconds.

To create default values for pins, weak pull-up resistors are used. The implemented pull-up resistors are software controlled.

Flexible API allows software development to use any programming language.

Note, that several GPIO-24 adapters can be connected to the PC simultaneously.

Communication with GPIO-24 adapter can be implemented using Win32 Dynamic Link Library – gpio24.dll. The DLL can recognize multiple GPIO-24 device instances and can be mapped into a number of processes (applications) running simultaneously.

Before using, gpio24.dll should be initialized with the help of GPIO_Init() function. During initialization the application selects one of the following notification types:

  • event object;

  • window messages;

  • thread messages;

  • callback function;

  • none.

For more detailed information refer to the Notification section.

When the initialization is done, the application must select the physical device(s) it wants to work with. The number of devices currently connected to the PC can be obtained with GPIO_GetDeviceCount() function. Every device or object has its own unique identifier (called handle) which is used to get access to the device. To open handle to the particular device use GPIO_OpenDevice() function.

Communication with GPIO-24 adapter can be synchronous and asynchronous. The difference between them is as follows. During the synchronous communication when the application receives a command, the thread stops running and waits the response of the device. During the asynchronous communication the thread doesn’t stop.

  • For asynchronous communication use GPIO_SendCommand() and GPIO_GetEvent() functions. When a command is sent, GPIO-24 adapter processes it and sends a response. When the driver receives the response it sends notification to the user mode application through selected notification method. Then you can call the GPIO_GetEvent() function to obtain the response details.

  • For synchronous communication use GPIO_Transaction() function. All required input and output data is passed through parameters and return code. The driver waits until the transaction is completed and passes the response to the calling application.

GPIO adapter can also generate events when input value on one of the pins is changed. When the event is received by driver, it notifies the application through the selected notification method. Then you can call the GPIO_GetEvent() function to obtain the event details.

Use GPIO_CloseDevice() function to close the device handle. When device handle is closed the application doesn’t receive events from the specific device, but the application still receives plug-and-play notifications.

When the application finishes using gpio_24.dll, the application has to call the GPIO_Uninit() function to free up resources allocated by the DLL.