8.
Functions for analog input/output
hid_GetAnalogChannel
This function reads a complete word from an analog input port of a device by
USB.
Declaration
BOOL
hid_GetAnalogChannel ( HANDLE hDevice,
DWORD
dwPort,
LPDWORD
lpdwPortState
);
Parameters
hDevice
A valid device handle, previously obtained from hid_OpenDeviceDevice dw
-
Port
The index of the port on the card to manipulate. The first port has index 0.
lpdwPortState
A pointer to a variable of type DWORD receiving the new state of the port
Return value
TRUE if successful, FALSE otherwise.
If an error occurred, GetLastError() may return the following values:
ERROR_INVALID_PARAMETER - The handle passed was invalid, or the port number was out of
range for the device selected.
Example
HANDLE hDevice = hid_OpenDevice(0x02,0); // USB_LABKIT
if (hDevice != INVALID_HANDLE_VALUE)
{
hid_GetAnalogChannel ( hDevice, 0, &dwState); // reads the state of the first analog input port
hid_CloseDevice (hDevice);
}
Remarks
This function now only enable in USB_LABKIT and USB_STARTER device. The range of dwPort
is from 0~7.