Once this has been done, is it possible to connect to the serial port directly and send or receive data using functions that are not within the FTDI library? I ask this because I am not sure if the FTD2XX drivers are separate from the VCP and FTDI do not provide documentation on serial communication using a USB VCP.Ģ) Are there any well documented function libraries/code suggestions that would enable me to read from it? If this requires some form of conversion, please can a well documented function library for this be suggested too?ģ) Are there any well documented function libraries for writing unsigned integers to the device I am communicating with via the USB VCP?īy the way, where did the FT_Write_String and FT_Write_Bytes functions presented in the question come from? ' Set the number of stop bits of the recorded deviceįT_Status = FT_SetDataCharacteristics(FT_Handle, FT_DATA_BITS_8, FT_STOP_BITS_2, FT_PARITY_NONE)ĭebug.Print("Stop bits, parity and data bits set")įT_Status = FT_Read_Bytes(FT_Handle, FT_In_Buffer(16), Read_Count, Read_Result)ġ) I have set the baud rate, stop bits and number of data bits using the FD2XX library.
Visual basic serial port example serial number#
' Get serial number of device with index 0įT_Status = FT_GetDeviceString(DeviceIndex, TempDevString, FT_LIST_BY_INDEX Or FT_OPEN_BY_SERIAL_NUMBER)įT_Serial_Number = (TempDevString, InStr(1, TempDevString, vbNullChar) - 1)įT_Status = FT_GetDeviceString(DeviceIndex, TempDevString, FT_LIST_BY_INDEX Or FT_OPEN_BY_DESCRIPTION)įT_Description = (TempDevString, InStr(1, TempDevString, vbNullChar) - 1)įT_Status = FT_SetBaudRate(FT_Handle, 1000000) Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
I would like now like to read and write from the serial port and I have some code and questions. I am using the FTD2XX library on Visual Basic 6 to display the name and serial number of a device (this already works), set the number of stop bits, set baud rates and the number of data bits. I am using an FTDI driver to communicate with an device via a USB VCP.
I am trying to establish a connection and read data from a virtual COM port using VB6, following on from my query here: Baud rate limits in software and serial communication with an external device.