FTDI Community

Please login or register.

Login with username, password and session length.
Advanced Search  

News:

Welcome to the FTDI Community!

Please read our Welcome Note

Technical Support enquires
please contact the team
@ FTDI Support


New Bridgetek Community is now open

Please note that we have created the Bridgetek Community to discuss all Bridgetek products e.g. EVE, MCU.

Please follow this link and create a new user account to get started.

Bridgetek Community

Author Topic: Create a Project Using the D2XX Drivers  (Read 16159 times)

FTDI Community

  • Administrator
  • Hero Member
  • *****
  • Posts: 896
    • View Profile
Create a Project Using the D2XX Drivers
« on: October 03, 2017, 11:27:30 AM »

The user can create 32bit or 64bit dynamic or statically linked projects using the D2XX drivers.

Read more in TN_153 Instructions on Including the D2XX Driver in a Visual Studio Express 2013 Project

The necessary driver files can be downloaded here:

D2XX Drivers

Note: The current free version of Visual Studio is Visual Studio Community 2017.
It allows you to use for 30 days without a Microsoft account. However, after this period it asks you to sign in. You can create a free Microsoft account which will allow you to continue to use Visual Studio for free.

The following simple code can be used as a test:

#include "stdafx.h"
#include <windows.h>
#include "ftd2xx.h"
int main()
{
FT_HANDLE ftHandle;
FT_STATUS ftStatus;
ftStatus = FT_Open(0, &ftHandle);
ftStatus |= FT_SetUSBParameters(ftHandle, 4096, 4096); // Set USB transfer sizes
ftStatus |= FT_SetChars(ftHandle, false, 0, false, 0); // Disable event characters
ftStatus |= FT_SetTimeouts(ftHandle, 5000, 5000); // Set read/write timeouts to 5 sec
ftStatus |= FT_SetLatencyTimer(ftHandle, 16); // Latency timer at default 16ms
ftStatus |= FT_SetFlowControl(ftHandle, FT_FLOW_NONE, 0x11, 0x13); // No flow control
ftStatus |= FT_SetBaudRate(ftHandle, 9600); // Baud rate = 9600
ftStatus |= FT_SetDataCharacteristics(ftHandle, FT_BITS_8, FT_STOP_BITS_1,
FT_PARITY_NONE);
if (ftStatus != FT_OK) printf("ftStatus not ok %d\n", ftStatus); //check for error
else
{
char data_out[12] = "Hello World";
DWORD w_data_len = 12;
DWORD data_written;
ftStatus = FT_Write(ftHandle, data_out, w_data_len, &data_written);
char data_in[12];
DWORD r_data_len = 12;
DWORD data_read;
ftStatus = FT_Read(ftHandle, data_in, r_data_len, &data_read);
if (ftStatus != FT_OK)
printf("ftStatus not ok %d\n", ftStatus);
else
printf("Data Read: %s\n", data_in);
}
ftStatus = FT_Close(ftHandle);
printf("Press Return To End Program");
getchar();
return 0;
}
Logged