📄 d2xx_module.bas
字号:
ManufacturerId As Long '16 "FT"
Description As Long '64 "USB HS Serial Converter"
SerialNumber As Long '16 "FT000001" if fixed, or NULL
MaxPower As Integer ' // 0 < MaxPower <= 500
PnP As Integer ' // 0 = disabled, 1 = enabled
SelfPowered As Integer ' // 0 = bus powered, 1 = self powered
RemoteWakeup As Integer ' // 0 = not capable, 1 = capable
'Rev4 extensions:
Rev4 As Byte ' // true if Rev4 chip, false otherwise
IsoIn As Byte ' // true if in endpoint is isochronous
IsoOut As Byte ' // true if out endpoint is isochronous
PullDownEnable As Byte ' // true if pull down enabled
SerNumEnable As Byte ' // true if serial number to be used
USBVersionEnable As Byte ' // true if chip uses USBVersion
USBVersion As Integer ' // BCD (0x0200 => USB2)
'FT2232C extensions:
Rev5 As Byte 'non-zero if Rev5 chip, zero otherwise
IsoInA As Byte 'non-zero if in endpoint is isochronous
IsoInB As Byte 'non-zero if in endpoint is isochronous
IsoOutA As Byte 'non-zero if out endpoint is isochronous
IsoOutB As Byte 'non-zero if out endpoint is isochronous
PullDownEnable5 As Byte 'non-zero if pull down enabled
SerNumEnable5 As Byte 'non-zero if serial number to be used
USBVersionEnable5 As Byte 'non-zero if chip uses USBVersion
USBVersion5 As Integer 'BCD 0x110 = USB 1.1, BCD 0x200 = USB 2.0
AlsHighCurrent As Byte 'non-zero if interface is high current
BlsHighCurrent As Byte 'non-zero if interface is high current
IFAlsFifo As Byte 'non-zero if interface is 245 FIFO
IFAlsFifoTar As Byte 'non-zero if interface is 245 FIFO CPU target
IFAlsFastSer As Byte 'non-zero if interface is Fast Serial
AlsVCP As Byte 'non-zero if interface is to use VCP drivers
IFBlsFifo As Byte 'non-zero if interface is 245 FIFO
IFBlsFifoTar As Byte 'non-zero if interface is 245 FIFO CPU target
IFBlsFastSer As Byte 'non-zero if interface is Fast Serial
BlsVCP As Byte 'non-zero if interface is to use VCP drivers
'FT232R extensions
UseExtOSC As Byte 'non-zero use ext osc
HighDriveIOs As Byte 'non-zero to use High Drive IO's
EndPointSize As Byte '64 Do not change
PullDownEnableR As Byte 'non-zeero if pull down enabled
SerNumEnableR As Byte 'non-zero if pull serial number enabled
InvertTXD As Byte 'non-zero if invert TXD
InvertRXD As Byte 'non-zero if invert RXD
InvertRTS As Byte 'non-zero if invert RTS
InvertCTS As Byte 'non-zero if invert CTS
InvertDTR As Byte 'non-zero if invert DTR
InvertDSR As Byte 'non-zero if invert DSR
InvertDCD As Byte 'non-zero if invert DCD
InvertRI As Byte 'non-zero if invert RI
Cbus0 As Byte 'Cbus Mux control
Cbus1 As Byte 'Cbus Mux control
Cbus2 As Byte 'Cbus Mux control
Cbus3 As Byte 'Cbus Mux control
Cbus4 As Byte 'Cbus Mux control
RIsVCP As Byte 'non-zero if using VCP driver
End Type
' Return codes
Public Const FT_OK = 0
Public Const FT_INVALID_HANDLE = 1
Public Const FT_DEVICE_NOT_FOUND = 2
Public Const FT_DEVICE_NOT_OPENED = 3
Public Const FT_IO_ERROR = 4
Public Const FT_INSUFFICIENT_RESOURCES = 5
Public Const FT_INVALID_PARAMETER = 6
Public Const FT_INVALID_BAUD_RATE = 7
Public Const FT_DEVICE_NOT_OPENED_FOR_ERASE = 8
Public Const FT_DEVICE_NOT_OPENED_FOR_WRITE = 9
Public Const FT_FAILED_TO_WRITE_DEVICE = 10
Public Const FT_EEPROM_READ_FAILED = 11
Public Const FT_EEPROM_WRITE_FAILED = 12
Public Const FT_EEPROM_ERASE_FAILED = 13
Public Const FT_EEPROM_NOT_PRESENT = 14
Public Const FT_EEPROM_NOT_PROGRAMMED = 15
Public Const FT_INVALID_ARGS = 16
Public Const FT_NOT_SUPPORTED = 17
Public Const FT_OTHER_ERROR = 18
' Word Lengths
Public Const FT_BITS_8 = 8
Public Const FT_BITS_7 = 7
' Stop Bits
Public Const FT_STOP_BITS_1 = 0
Public Const FT_STOP_BITS_1_5 = 1
Public Const FT_STOP_BITS_2 = 2
' Parity
Public Const FT_PARITY_NONE = 0
Public Const FT_PARITY_ODD = 1
Public Const FT_PARITY_EVEN = 2
Public Const FT_PARITY_MARK = 3
Public Const FT_PARITY_SPACE = 4
' Flow Control
Public Const FT_FLOW_NONE = &H0
Public Const FT_FLOW_RTS_CTS = &H100
Public Const FT_FLOW_DTR_DSR = &H200
Public Const FT_FLOW_XON_XOFF = &H400
' Purge rx and tx buffers
Public Const FT_PURGE_RX = 1
Public Const FT_PURGE_TX = 2
' Modem Status
Public Const FT_MODEM_STATUS_CTS = &H10
Public Const FT_MODEM_STATUS_DSR = &H20
Public Const FT_MODEM_STATUS_RI = &H40
Public Const FT_MODEM_STATUS_DCD = &H80
Public Const FT_EVENT_RXCHAR As Long = 1
Public Const FT_EVENT_MODEM_STATUS = 2
Const WAIT_ABANDONED As Long = &H80
Const WAIT_FAILD As Long = &HFFFFFFFF
Const WAIT_OBJECT_0 As Long = &H0
Const WAIT_TIMEOUT As Long = &H102
' Flags for FT_ListDevices
Public Const FT_LIST_BY_NUMBER_ONLY = &H80000000
Public Const FT_LIST_BY_INDEX = &H40000000
Public Const FT_LIST_ALL = &H20000000
' Flags for FT_OpenEx
Public Const FT_OPEN_BY_SERIAL_NUMBER = 1
Public Const FT_OPEN_BY_DESCRIPTION = 2
Private Const INFINITE As Long = 1000 '&HFFFFFFFF
Global hThread As Long
Global hThreadID As Long
Global hEvent As Long
Global EventMask As Long
Global lngHandle As Long
Sub Main()
Set fMainForm = New DEMO_EEPROM
fMainForm.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -