Component: FTDI (FTD2XX) (Comms: Interface)
Author | Matrix Ltd |
Version | 1.0 (Release) |
Category | Comms: Interface |
Contents
- 1 FTDI (FTD2XX) component
- 2 Examples
- 3 Downloadable macro reference
- 4 Simulation macro reference
- 4.1 FT_GetStatus
- 4.2 FT_ClrRts
- 4.3 FT_Write
- 4.4 FT_SetFlowControl
- 4.5 FT_SetBreakOn
- 4.6 FT_Read
- 4.7 FT_GetModemStatus
- 4.8 FT_CreateDeviceInfoList
- 4.9 FT_SetTimeouts
- 4.10 FT_SetBitMode
- 4.11 FT_SetRts
- 4.12 FT_GetDeviceInfoDetail
- 4.13 FT_Close
- 4.14 FT_ClrDtr
- 4.15 FT_Purge
- 4.16 FT_GetQueueStatus
- 4.17 FT_SetDataCharacteristics
- 4.18 FT_SetBreakOff
- 4.19 FT_SetDivisor
- 4.20 FT_SetBaudRate
- 4.21 FT_SetDtr
- 4.22 ScanFor232
- 4.23 FT_Open
- 4.24 FT_SetChars
- 4.25 FT_ResetDevice
- 5 Property reference
FTDI (FTD2XX) component
Simulation only interface to allow communications with a FTDI USB 232 IC connected to the system. For more details refer to the D2XX_Programmers_Guide from FTDI.
Examples
No additional examples
Downloadable macro reference
This component does not contain any downloadable macros
Simulation macro reference
FT_GetStatus
Gets the device status including number of characters in the receive queue, number of characters in the transmit queue, and the current event status.
Parameters
- LONG Handle
- Handle of the device.
- LONG RxQueueLength
- Pointer to a variable of type DWORD which receives the number of characters in the receive queue.
- LONG TxQueueLength
- Pointer to a variable of type DWORD which receives the number of characters in the transmit queue.
- LONG EventStatus
- Pointer to a variable of type DWORD which receives the current state of the event status.
Return value
FT_ClrRts
This function clears the Request To Send (RTS) control signal.
Parameters
- LONG Handle
- Handle of the device.
Return value
- This call does not return a value
FT_Write
Write data to the device.
Parameters
- LONG Handle
- Handle of the device.
- BYTE Buffer
- Pointer to the buffer that contains the data to be written to the device.
- ULONG Bytes
- Number of bytes to write to the device.
- ULONG Count
- Pointer to a variable of type DWORD which receives the number of bytes written to the device.
Return value
FT_SetFlowControl
This function sets the flow control for the device.
Parameters
- LONG Handle
- Handle of the device.
- UINT FlowControl
- Flow setting 0=None, 0x0100=RTS/CTS, 0x0200=DTR/DSR, 0x0400=XON/XOFF
- BYTE Xon
- Character used to signal Xon. Only used if flow control is Xon/Xoff
- BYTE Xoff
- Character used to signal Xoff. Only used if flow control is Xon/Xoff
Return value
FT_SetBreakOn
Sets the BREAK condition for the device.
Parameters
- LONG Handle
- Handle of the device.
Return value
FT_Read
Read data from the device.
Parameters
- LONG Handle
- Handle of the device.
- BYTE Buffer
- Pointer to the buffer that receives the data from the device.
- ULONG Bytes
- Number of bytes to be read from the device.
- ULONG Count
- Pointer to a variable of type DWORD which receives the number of bytes read from the device.
Return value
FT_GetModemStatus
Gets the modem status and line status from the device.
Parameters
- LONG Handle
- Handle of the device.
- LONG ModemStatus
- Pointer to a variable of type DWORD which receives the modem status and line status from the device.
Return value
FT_CreateDeviceInfoList
This function builds a device information list and returns the number of D2XX devices connected to the system. The list contains information about both unopen and open devices.
Parameters
- LONG DevCount
- Unsigned long array used to store the number of devices connected
Return value
FT_SetTimeouts
This function sets the read and write timeouts for the device.
Parameters
- LONG Handle
- Handle of the device.
- LONG ReadTimeout
- Read timeout in milliseconds.
- LONG WriteTimeout
- Write timeout in milliseconds.
Return value
FT_SetBitMode
Enables different chip modes.
Parameters
- LONG Handle
- Handle of the device.
- BYTE Mask
- Required value for bit mode mask. This sets up which bits are inputs and outputs. A bit value of 0 sets the corresponding pin to an input, a bit value of 1 sets the corresponding pin to an output.
- BYTE Mode
- 0=Reset / 1=AsyncBB / 2=MPSSE / 4=SyncBB / 8=MCUHost / 16=FastOpto / 32=CBUS / 64=SyncFIFO
Return value
FT_SetRts
This function sets the Request To Send (RTS) control signal.
Parameters
- LONG Handle
- Handle of the device.
Return value
FT_GetDeviceInfoDetail
This function returns an entry from the device information list.
Parameters
- ULONG Index
- Index of the entry in the device info list.
- ULONG Flags
- Pointer to unsigned long to store the flag value.
- ULONG Type
- Pointer to unsigned long to store device type.
- ULONG ID
- Pointer to unsigned long to store device ID.
- ULONG LocID
- Pointer to unsigned long to store the device location ID.
- BYTE SerNum
- Pointer to buffer to store device serial number as a null terminated string
- BYTE Descript
- Pointer to buffer to store device description as a null-terminated string
- LONG TempHandle
- Pointer to a variable of type FT_HANDLE where the handle will be stored
Return value
FT_Close
Close an open device.
Parameters
- LONG Handle
- Handle of the device.
Return value
FT_ClrDtr
This function clears the Data Terminal Ready (DTR) control signal.
Parameters
- LONG Handle
- Handle of the device.
Return value
FT_Purge
This function purges receive and transmit buffers in the device.
Parameters
- LONG Handle
- Handle of the device.
- LONG Mask
- Used to determine which buffer to purge, 1=Rx / 2=Tx / 3=Both
Return value
FT_GetQueueStatus
Gets the number of bytes in the receive queue.
Parameters
- LONG Handle
- Handle of the device.
- LONG RxQueueLength
- Pointer to a variable of type DWORD which receives the number of bytes in the receive queue.
Return value
FT_SetDataCharacteristics
This function sets the data characteristics for the device.
Parameters
- LONG Handle
- Handle of the device.
- BYTE WordLength
- Number of bits per word - Must be 7 or 8
- BYTE StopBits
- Number of stop bits - Must be 1 or 2
- BYTE Parity
- Parity 0=None / 1=Odd / 2=Even / 3=Mark / 4=Space
Return value
FT_SetBreakOff
Resets the BREAK condition for the device.
Parameters
- LONG Handle
- Handle of the device.
Return value
FT_SetDivisor
This function sets the baud rate for the device. It is used to set non-standard baud rates.
Parameters
- LONG Handle
- Handle of the device.
- UINT Divisor
- Divisor.
Return value
FT_SetBaudRate
This function sets the baud rate for the device.
Parameters
- LONG Handle
- Handle of the device.
- ULONG BaudRate
- Baud rate.
Return value
FT_SetDtr
This function sets the Data Terminal Ready (DTR) control signal.
Parameters
- LONG Handle
- Handle of the device.
Return value
ScanFor232
Scans for a FTDI D2XX device, returnes true if at least one device was found.
Parameters
- This macro has no parameters
Return value
- BOOL : Returns true if the operation is a success, else false
FT_Open
Open the device and return a handle which will be used for subsequent accesses.
Parameters
- INT Device
- Index of the device to open. Indices are 0 based.
- LONG ft_Handle
- Pointer to a variable of type FT_HANDLE where the handle will be stored. This handle must be used to access the device.
Return value
FT_SetChars
This function sets the special characters for the device.
Parameters
- LONG Handle
- Handle of the device.
- BYTE EventCh
- Event character.
- BYTE EventChEn
- 0 if event character disabled, non-zero otherwise.
- BYTE ErrorCh
- Error character.
- BYTE ErrorChEn
- 0 if error character disabled, non-zero otherwise.
Return value
FT_ResetDevice
This function sends a reset command to the device.
Parameters
- LONG Handle
- Handle of the device.
Return value
Property reference
Label
This property is of type Line of text and can be referenced with the variable name label.
A text label for the component's panel component.