Code Examples

Visual C++ Examples

This page contains examples of communicating with FTDI devices through the D2XX drivers and FTD2XX.DLL using Visual C++.

Example 1

Our thanks to DLP Design for contributing this application source code which illustrates how to integrate D2XX drivers into a Visual C++ project and use some of the basic functions available.

For more information on DLP Design products, visit the DLP Design website or our own Evaluation Kits page.

To download the example, click here.

Example 2

This example shows how to use Visual C++.NET to communicate with FTDI devices through FTD2XX.DLL.  This includes using FT_ListDevices, FT_Write and FT_Read with a loop-back connector to write data to the device and then read it back.

To download the example, click here.

Example 3

This variant of FTDI’s D2XXAccess example for Windows CE uses C++ to list devices, return description strings, open devices, set Baud rates, read data and write data.  This example is also available in C# and VB.NET for Windows CE platforms.

This code requires that FTDI’s D2XX drivers for Windows CE be installed.  These can be obtained through our Drivers page.

To download the C++ version of D2XXAccess for Windows CE, click here.

Example 4

This Visual C++.NET example demonstrates how to use the CBUS Bit Bang mode of the FT232R device.  Please note that the CBUS pins must be configured in the integrated EEPROM before they can be used for CBUS Bit Bang mode.  FTDI’s D2XX drivers must also be installed for the application to run.

To download this example, click here.

Example 5

This example shows how to use the FT_GetComPortNumber function call to determine the COM port assigned to a device and then how to open it.

To download this example, click here.

Example 6

This example shows how to interface FT2232H Hi-Speed devices to I2C bus .

To download this example, click here.

Example 7

This example shows how to use the Windows RegisterDeviceNotification function to receive WM_DEVICECHANGE messages when USB devices are inserted or removed from a system as outlined in application note AN_152.

To download this example, click here.

Example 8

This example shows how to use the D2xx commands to configure the configuration EEPROMs associated with our USB bridge devices as outlined in application note AN_428. Examples include support for FT232R, FT-X Series, FT232H, FT2232H and FT4232H devices

To download this example,click here.