General Category > Discussion - Hardware

FT232H handle in visual studio

(1/1)

Rajesh@sys:
Hi,

 i am using visual studio 2017 to configure FT232H to synchronous mode.
i am able to detect ft232h as comport.(using vcp drivers)

as given pdf (building application  in visual studio) i have included .dll files from and header file  "d2xx driver".

i have used code from "TN_167 FIFO Basics (USB2.0)" fifo synchronous read code.


with these i am able  confirm FTDI IC is connected. as it showing(command prompt) code is excited with 0.

if i disconnect usb i am able to see "device status not ok".



my query is :

1) why i am not able to access ft_handle function.

2) code is everytime entering into null.


please suggest me., how access ft_handle



thanks

FTDI Community:
Hello Rajesh,

Please see TN_153 Instructions on Including the D2XX Driver in a Visual Studio Express 2013 Project for more information.


--- Code: ---ft_handle is used as follows:

FT_HANDLE fthandle;
FT_STATUS status;

status = FT_Open(0, &fthandle);
--- End code ---

The status should be checked for errors. Error codes can be found in ftd2xx.h. FT_OK is 0.

This code snippet is opening the first FTDI device connected to the PC. You may want to make the code more robust by opening by serial number or description, for example:


--- Code: ---status = FT_OpenEx("FTEE5MM", FT_OPEN_BY_SERIAL_NUMBER, &fthandle);
--- End code ---

or


--- Code: ---status = FT_OpenEx("FT232H", FT_OPEN_BY_DESCRIPTION, &fthandle);
--- End code ---

All devices can be listed first using FT_CreateDeviceInfoList and FT_GetDeviceInfoList first. See the D2XX Programmer's Guide for more information.

If the device is not connected, the function status will return an error code.

TN_167 code could be improved to exit the code when there are errors:


--- Code: ---if(status != FT_OK)
{
printf("open device status not ok %d\n", status);
return 0;
}
--- End code ---

Sometimes brackets are not used meaning that the code will continue:


--- Code: ---if(status != FT_OK)
printf("timeout A status not ok %d\n", status);
--- End code ---

Best Regards,
FTDI Community

Rajesh@sys:
Hi,
   I have a doubt that the procedure which you mentioned in previous reply is similar for visual studio 2017 as I am using this IDE.
waiting for someone to help.

Regards,
Rajesh

FTDI Community:
Hello Rajesh,

The procedure in my previous post is for C Programming in Visual Studio IDE.

Please refer to TN_153 Instructions on Including the D2XX Driver in a Visual Studio Express 2013 Project.

Best Regards,
FTDI Community

Navigation

[0] Message Index

Go to full version