com_SetDigitalByte
This function sets or clears a byte on a digital output line by Serial Port.
Declaration
BOOL
com_SetDigitalByte ( HANDLE hDevice,
DWORD
dwPort,
BYTE
byPortState
);
Parameters
hDevice
A valid device handle, previously obtained from com_OpenDevice
dwPort
The index of the port on the card to manipulate. The first port has index 0. For
more information, please see “Write Address Table” following below.
byPortState
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 = com_OpenDevice(0x01,0);
if (hDevice != INVALID_HANDLE_VALUE)
{
com_SetDigitalByte( hDevice, 0, 0xFF); // set’s all bits on the first port
com_CloseDevice(hDevice);
}
Remarks
Please see “Serial_Communication.pdf” to set hardware for serial communication, and USB_LAB
-
KIT, USB_STARTER, USB_8PR are not supported by serial communication.