Join the Conversation

11 Comments

  1. The link in this post is via Google Translate, you can’t download from the site software links when in Google Translate. Therefore, the native page in Italian is here:

    http://www.qubbeks.puslapiai.lt/articles.php?article_id=35

    That said, this code is Windows only and it seems the Author is withholding the source :-( The software is stand alone, so it does not require any installation – just download, extract the .rar archive, and run the .exe.

      1. I never delete comments unless they are clear spam, but being nice is about the only rule here and those comments were clearly not, and also didn’t contribute anything, so they are gone.

        Also funny to pick on Americans given half the hits and commentors here are non-US :P

  2. If only people were not so lazy……
    There are loads and loads of samples of source code available on the FTDI chip page..

    C Sharp (requires .NET interface DLL to be included in project)
    Delphi
    LabVIEW (7.0 and later)
    Visual Basic 6
    Visual Basic .NET (requires .NET interface DLL to be included in project)
    Visual C++ (Console Application)
    Visual C++ (MFC)
    Visual C++ (Win32)

    Its not that difficult, I threw together a library for java for OSX a few years ago.

    1. please help me in building a small software to control FT245RL 4 RELAY IN WITH HELP OF SMALL INTERFACE ON WINDOWS

  3. hi,

    can you please help me with a console app to control an led?

    have tried below code but not working :

    Option Strict Off
    Option Explicit On
    Imports System.Threading
    Imports System.Globalization
    Imports System.IO

    Module Module1

    Private Declare Function FT_Open Lib “FTD2XX.dll” (ByVal intDeviceNumber As Short, ByRef lnghandle As Integer) As Integer
    Private Declare Function FT_OpenEx Lib “FTD2XX.dll” (ByVal arg1 As String, ByVal arg2 As Integer, ByRef lnghandle As Integer) As Integer
    Private Declare Function FT_Close Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_Read Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal lpszBuffer As String, ByVal lngBufferSize As Integer, ByRef lngBytesReturned As Integer) As Integer
    Private Declare Function FT_Write Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal lpszBuffer As String, ByVal lngBufferSize As Integer, ByRef lngBytesWritten As Integer) As Integer
    Private Declare Function FT_SetBaudRate Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal lngBaudRate As Integer) As Integer
    Private Declare Function FT_SetDataCharacteristics Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal byWordLength As Byte, ByVal byStopBits As Byte, ByVal byParity As Byte) As Integer
    Private Declare Function FT_SetFlowControl Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal intFlowControl As Short, ByVal byXonChar As Byte, ByVal byXoffChar As Byte) As Integer
    Private Declare Function FT_ResetDevice Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_SetDtr Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_ClrDtr Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_SetRts Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_ClrRts Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_GetModemStatus Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByRef lngModemStatus As Integer) As Integer
    Private Declare Function FT_Purge Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal lngMask As Integer) As Integer
    Private Declare Function FT_GetStatus Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByRef lngRxBytes As Integer, ByRef lngTxBytes As Integer, ByRef lngEventsDWord As Integer) As Integer
    Private Declare Function FT_GetQueueStatus Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByRef lngRxBytes As Integer) As Integer
    Private Declare Function FT_GetEventStatus Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByRef lngEventsDWord As Integer) As Integer
    Private Declare Function FT_SetChars Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal byEventChar As Byte, ByVal byEventCharEnabled As Byte, ByVal byErrorChar As Byte, ByVal byErrorCharEnabled As Byte) As Integer
    Private Declare Function FT_SetTimeouts Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal lngReadTimeout As Integer, ByVal lngWriteTimeout As Integer) As Integer
    Private Declare Function FT_SetBreakOn Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_SetBreakOff Lib “FTD2XX.dll” (ByVal lnghandle As Integer) As Integer
    Private Declare Function FT_ListDevices Lib “FTD2XX.dll” (ByVal arg1 As Integer, ByVal arg2 As String, ByVal dwFlags As Integer) As Integer
    Private Declare Function FT_GetNumDevices Lib “FTD2XX.dll” Alias “FT_ListDevices” (ByRef arg1 As Integer, ByVal arg2 As String, ByVal dwFlags As Integer) As Integer
    Private Declare Function FT_SetBitMode Lib “FTD2XX.dll” (ByVal lnghandle As Integer, ByVal mask As Byte, ByVal enable As Byte) As Integer

    ‘ Return codes
    Const FT_OK As Short = 0
    Const FT_INVALID_HANDLE As Short = 1
    Const FT_DEVICE_NOT_FOUND As Short = 2
    Const FT_DEVICE_NOT_OPENED As Short = 3
    Const FT_IO_ERROR As Short = 4
    Const FT_INSUFFICIENT_RESOURCES As Short = 5
    Const FT_INVALID_PARAMETER As Short = 6
    Const FT_INVALID_BAUD_RATE As Short = 7

    ‘ Word Lengths
    Const FT_BITS_8 As Short = 8
    Const FT_BITS_7 As Short = 7

    ‘ Stop Bits
    Const FT_STOP_BITS_1 As Short = 0
    Const FT_STOP_BITS_1_5 As Short = 1
    Const FT_STOP_BITS_2 As Short = 2

    ‘ Parity
    Const FT_PARITY_NONE As Short = 0
    Const FT_PARITY_ODD As Short = 1
    Const FT_PARITY_EVEN As Short = 2
    Const FT_PARITY_MARK As Short = 3
    Const FT_PARITY_SPACE As Short = 4

    ‘ Flow Control
    Const FT_FLOW_NONE As Integer = &H0
    Const FT_FLOW_RTS_CTS As Integer = &H100
    Const FT_FLOW_DTR_DSR As Integer = &H200
    Const FT_FLOW_XON_XOFF As Integer = &H400

    ‘ Purge rx and tx buffers
    Const FT_PURGE_RX As Short = 1
    Const FT_PURGE_TX As Short = 2

    ‘ Flags for FT_OpenEx
    Const FT_OPEN_BY_SERIAL_NUMBER As Short = 1
    Const FT_OPEN_BY_DESCRIPTION As Short = 2

    ‘ Flags for FT_ListDevices
    Const FT_LIST_BY_NUMBER_ONLY As Integer = &H80000000
    Const FT_LIST_BY_INDEX As Integer = &H40000000
    Const FT_LIST_ALL As Integer = &H20000000
    Dim RelState As Integer
    Dim lnghandle As Integer

    Sub SetRelays(ByVal RelayN As Short, ByRef State As Boolean)
    Dim lngBytesWritten As Object
    Dim strWriteBuffer As Object
    ‘Open the first device

    Dim temp As Integer
    ‘ Dim i As Short

    If (State = True) Then
    If RelayN = 1 Then temp = 1
    If RelayN = 2 Then temp = 2
    If RelayN = 3 Then temp = 4
    If RelayN = 4 Then temp = 8
    If RelayN = 5 Then temp = 16
    If RelayN = 6 Then temp = 32
    If RelayN = 7 Then temp = 64
    If RelayN = 8 Then temp = 128
    If RelayN = 255 Then temp = 255
    RelState = RelState Or temp
    End If

    If (State = False) Then
    If RelayN = 1 Then temp = 254
    If RelayN = 2 Then temp = 253
    If RelayN = 3 Then temp = 251
    If RelayN = 4 Then temp = 247
    If RelayN = 5 Then temp = 239
    If RelayN = 6 Then temp = 223
    If RelayN = 7 Then temp = 191
    If RelayN = 8 Then temp = 127
    If RelayN = 0 Then temp = 0
    RelState = RelState And temp
    End If

    ‘MsgBox (Str(RelState) + “,” + Str(temp))

    strWriteBuffer = ” ”

    Mid(strWriteBuffer, 1, 1) = Chr(RelState)

    lngBytesWritten = 0

    End Sub

    Sub Main()

    Call SetRelays(1, True)
    Dim SAPI

    SAPI = CreateObject(“SAPI.spvoice”)

    SAPI.Speak(“Light is ON”)

    End Sub

    End Module

Leave a comment

Your email address will not be published. Required fields are marked *

Notify me of followup comments via e-mail. You can also subscribe without commenting.