ADU  Series - USB Data Acquisition Interface SDK 

ReadAdu232

This function reads data from the ADU RS232 pipe. The number of bytes read is returned in lpNumberOfBytesRead.

The handle value must be the value returned by the open call.

ADU RS232 data blocks are limited to 40 characters in length.

C Declaration:

int __stdcall ReadAdu232(void * hDevice,
const void * lpBuffer,
unsigned long nNumberOfBytesToRead,
unsigned long * lpNumberOfBytesRead,
unsigned long iTimeout);

Visual Basic Declaration:

Declare Function ReadAdu232 Lib "AduHid.DLL" _
(ByVal aduHandle As Long, ByVal lpBuffer As String, _
ByVal lNumberOfBytesToRead As Long, _
ByRef lBytesRead As Long, ByVal iTimeout As Long) As Long

Arguments:

Argument Type Value Description
hDevice void * value from open call handle to the device
lpBuffer const char * address of buffer buffer to receive data
nNumberOfBytesToRead unsigned long &GT 0 number of bytes to read
lpNumberOfBytesRead unsigned long *   number of bytes read
iTimeout unsigned long   milli-seconds to wait


A non-zero iTimeout value can only be supplied if timeout processing was activated during the open call. (ie. a non-zero iTimeout value was passed into the open function)

Return Codes:

Value Description
0 call failed
other call succeeded

Note: call GetLastError to get more information about a failed read operation.

Programming Notes

The Adu232 pipe uses hex zero bytes internally as a transmission delimiter. No hex zero bytes are passed back to the calling application. An application that intends to use the response as a zero-terminated string must allocate an extra byte for the buffer and zero-fill the buffer before the ReadAdu232 call.