This page contains examples of communicating with FTDI devices through the D2XX drivers and FTD2XX.DLL using C#.
FTDI have provided a managed .NET wrapper class for the FTD2XX DLL on the Windows platform. The managed wrapper DLL (FTD2XX_NET.DLL) is provided as a free download with Intellisense documentation provided in the FTD2XX_NET.XML file – this is viewable in the Visual Studio Object Browser and also provides hints as the code is written.
Examples 3 and 4 below both show how to use the FTD2XX_NET interface DLL. A reference should be added to the FTD2XX_NET.DLL file in the Solution Explorer. Simply right-click on the References item in the Solution Explorer in your Visual Studio project, select “Add Reference” then “Browse” and locate the DLL. The XML file should be placed in the same location
To download the .NET Wrapper source code, click here
KOPF GmbH have developed an application example in C# called “USBTransfer” which can be downloaded by clicking here. It requires the addition of a secondary DLL (AID.DLL) in C# style. To download this DLL from the FTDI web site, click here. Alternatively, please visit the KOPF GmbH web site http://www.kopfweb.de for up to date information (in German) and the latest downloads.
Our thanks to Oliver Kopf of KOPF GmbH for making this example available.
These programs and examples are provided “as-is” and neither FTDI or KOPF GmbH warrant their suitability for any purpose.
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 VB.NET and C++ for Windows CE platforms.
To download the C# version of D2XXAccess for Windows CE, click here.
This code provides a data loopback example showing how to write to and read from a device using the FTD2XX_NET interface DLL. “Hello World!” is written to the device and read back from it – note that note that TXD must be shorted to RXD, and CTS# shorted to RTS#, for this example to work.
To download the C# version of LoopBack for Windows, click here.
This code provides an example of changing the serial number in a device EEPROM using the FTD2XX_NET interface DLL. The EEPROM is read and the serial number is changed to an empty string (which allows the FTD2XX DLL to generate a serial number) before programming the EEPROM with the new contents.
To download the C# version of EEPROM for Windows, click here.
A sample demonstrating the use of the C# wrapper with the D2xx driver, for the FT232H, FT2232H and FT4232H devices to create an I2C master through the MPSSE mode as described in AN_411 is provided for users to experiment with, and extend into their own applications.
To download this example, please click here.