EmbeddedRelated.com
Forums

FTDI USB BitBang example code for Visual Basic

Started by steve August 25, 2004
Hi,
Does anyone have or know where to find FTDI USB BitBang example code for
Visual Basic?
I am using the direct drivers, but am having difficulty with a few of the
calls.
Thanks,
Steve


Steve,

I presume that you really me "byte-banging"?
I have some VB "byte-banging" code for the 
FTDI USB direct drivers, but not bitBanging. 



Option Explicit

Public Declare Function FT_ListDevices Lib "FTD2XX.DLL" (ByRef
lngIndex As Long, ByRef strBuffer As Variant, ByVal lngFlags As Long)
As Long
Public Declare Function FT_OpenEx Lib "FTD2XX.DLL" (ByVal lpszBuffer
As String, ByVal lngFlags As Long, ByRef lngHandle) As Long
Public Declare Function FT_Open Lib "FTD2XX.DLL" (ByVal
lngDeviceNumber As Long, ByRef lngHandle As Long) As Long
Public Declare Function FT_Close Lib "FTD2XX.DLL" (ByVal lngHandle As
Long) As Long
Public Declare Function FT_Read Lib "FTD2XX.DLL" (ByVal lngHandle As
Long, ByVal lpszBuffer As String, ByVal lngBufferSize As Long, ByRef
lngBytesReturned As Long) As Long
Public Declare Function FT_Write Lib "FTD2XX.DLL" (ByVal lngHandle As
Long, ByVal lpszBuffer As String, ByVal lngBufferSize As Long, ByRef
lngBytesWritten As Long) As Long
Public Declare Function FT_ResetDevice Lib "FTD2XX.DLL" (ByVal
lngHandle As Long) As Long
Public Declare Function FT_GetModemStatus Lib "FTD2XX.DLL" (ByVal
lngHandle As Long, ByRef lngModemStatus As Long) As Long
Public Declare Function FT_Purge Lib "FTD2XX.DLL" (ByVal lngHandle As
Long, ByVal lngMask As Long) As Long
Public Declare Function FT_GetStatus Lib "FTD2XX.DLL" (ByVal lngHandle
As Long, ByRef lngRxBytes As Long, ByRef lngTxBytes As Long, ByRef
lngEventsDWord As Long) As Long
Public Declare Function FT_GetQueueStatus Lib "FTD2XX.DLL" (ByVal
lngHandle As Long, ByRef lngRxBytes As Long) As Long
Public Declare Function FT_GetEventStatus Lib "FTD2XX.DLL" (ByVal
lngHandle As Long, ByRef lngEventsDWord As Long) As Long
Public Declare Function FT_SetTimeouts Lib "FTD2XX.DLL" (ByVal
lngHandle As Long, ByVal lngReadTimeout As Long, ByVal lngWriteTimeout
As Long) As Long
Public Declare Function FT_SetEventNotification Lib "FTD2XX.DLL"
(ByVal lngHandle As Long, ByVal lngEventMask As Long, ByVal
lngFunctionPointer As Long) As Long



On Wed, 25 Aug 2004 17:54:10 GMT, "steve" <idontthinkso@spamnot.com>
wrote:
>Does anyone have or know where to find FTDI USB BitBang example code for >Visual Basic? >I am using the direct drivers, but am having difficulty with a few of the >calls. Thanks, Steve
g9u5dd43@yahoo.com wrote:
> Steve, > > I presume that you really me "byte-banging"? > I have some VB "byte-banging" code for the > FTDI USB direct drivers, but not bitBanging. > > > > Option Explicit > > Public Declare Function FT_ListDevices Lib "FTD2XX.DLL" (ByRef > lngIndex As Long, ByRef strBuffer As Variant, ByVal lngFlags As Long) > As Long > Public Declare Function FT_OpenEx Lib "FTD2XX.DLL" (ByVal lpszBuffer > As String, ByVal lngFlags As Long, ByRef lngHandle) As Long > Public Declare Function FT_Open Lib "FTD2XX.DLL" (ByVal > lngDeviceNumber As Long, ByRef lngHandle As Long) As Long > Public Declare Function FT_Close Lib "FTD2XX.DLL" (ByVal lngHandle As > Long) As Long > Public Declare Function FT_Read Lib "FTD2XX.DLL" (ByVal lngHandle As > Long, ByVal lpszBuffer As String, ByVal lngBufferSize As Long, ByRef > lngBytesReturned As Long) As Long > Public Declare Function FT_Write Lib "FTD2XX.DLL" (ByVal lngHandle As > Long, ByVal lpszBuffer As String, ByVal lngBufferSize As Long, ByRef > lngBytesWritten As Long) As Long > Public Declare Function FT_ResetDevice Lib "FTD2XX.DLL" (ByVal > lngHandle As Long) As Long > Public Declare Function FT_GetModemStatus Lib "FTD2XX.DLL" (ByVal > lngHandle As Long, ByRef lngModemStatus As Long) As Long > Public Declare Function FT_Purge Lib "FTD2XX.DLL" (ByVal lngHandle As > Long, ByVal lngMask As Long) As Long > Public Declare Function FT_GetStatus Lib "FTD2XX.DLL" (ByVal lngHandle > As Long, ByRef lngRxBytes As Long, ByRef lngTxBytes As Long, ByRef > lngEventsDWord As Long) As Long > Public Declare Function FT_GetQueueStatus Lib "FTD2XX.DLL" (ByVal > lngHandle As Long, ByRef lngRxBytes As Long) As Long > Public Declare Function FT_GetEventStatus Lib "FTD2XX.DLL" (ByVal > lngHandle As Long, ByRef lngEventsDWord As Long) As Long > Public Declare Function FT_SetTimeouts Lib "FTD2XX.DLL" (ByVal > lngHandle As Long, ByVal lngReadTimeout As Long, ByVal lngWriteTimeout > As Long) As Long > Public Declare Function FT_SetEventNotification Lib "FTD2XX.DLL" > (ByVal lngHandle As Long, ByVal lngEventMask As Long, ByVal > lngFunctionPointer As Long) As Long > > > > On Wed, 25 Aug 2004 17:54:10 GMT, "steve" <idontthinkso@spamnot.com> > wrote: > >>Does anyone have or know where to find FTDI USB BitBang example code for >>Visual Basic? >>I am using the direct drivers, but am having difficulty with a few of the >>calls. Thanks, Steve > >
Thanks, The RevB FTDI chips have a new mode called BitBang mode. This basically latches data to the data lines until another write is performed. Reading also possible. Individual bits can be I or O. I was able to get some examples from dlpdesign to work with. Steve