-
18
-
4.Operation
4.1.
Preparation
ZS-6228-8N uses API made by FTDI inc, depending on each programming language, include
the following files.
Visual Basic
:
D2XX_Module.bas
Visual C++
:
FTD2XX.H
、
FTD2XX.lib
Delphi
:
D2XXUnit.pas
4.2.Function
In order to input photocoupler, use the following function. See D2XXPG34.pdf for detail on
this function.
FT_Open
:
Open the USB port.
FT_OpenEx
:
Open the USB port when using multiple units.
FT_Close
:
Colse the USB port.
FT_SetBitMode
:
Set the I/O of the 8-bit port.
FT_SetBaudRate
:
Set the rewrite time of 8 bits.
FT_GetBitMode
:
Load photocoupler.
4.2.1. FT_Open
Function
Open the USB port and initialized.
Format
FT_Open (int iDevice, FT_HANDLE *ftHandle)
iDevice
:
Set ”0”
ftHandle
:
If FT_Open is successful, the handle number will be returned.
Use this handle number when using other functions.
Return value
FT_OK
:
In case of “0”, success
Other than “0”
:
Error
4.2.2. FT_OpenEx
Function
Open the USB port and initialized.
In case of using multipul units, execute”FT_OpenEx” for each one. It is possible to
control by acquiring the handle number of each and using that number when using
other function.
Format
FT_OpenEx (PVOID pvArg1, DWORD dwFlags, FT_HANDLE *ftHandle)
pvArg1
:
Set the product serial number (K-xxxxxx).
dwFlags
:
Set “FT_OPEN_BY_SERIAL_NUMBER”.
ftHandle
:
If FT_Open is successful, the handle number will be returned.
Use this handle number when using other functions.
Return value
FT_OK
:
In case of “0”, success
Other than “0”
:
Error