亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? module1.bas

?? FTDI設備測試和校準源程序。FT232R為例
?? BAS
?? 第 1 頁 / 共 3 頁
字號:
    Saved_Port_Value = &H8                      ' set the initial state of the first 8 lines
    ' set the low byte
    AddToBuffer &H80                            ' Set data bits low byte command
    AddToBuffer &H8                             ' set CS=high, DI=low, DO=low, SK=low
    AddToBuffer &HB                             ' CS=output, DI=input, DO=output, SK=output
    ' set the clock divisor
    AddToBuffer &H86                            ' set clock divisor command to 1MHz
    AddToBuffer &H5                             ' low byte
    AddToBuffer &H0                             ' high byte
    AddToBuffer &H85                            ' turn off loopback
    SendBytes OutIndex                          ' send to command processor
    
    ' check for a bad command being echoed back
    Res = Get_USB_Device_QueueStatus
    If FT_Q_Bytes > 0 Or Res <> 0 Then
        Form1.shpOK.BackColor = Yellow
        Form1.lblStatus.Caption = "Possible bad command detected in procedure OpenDevice."
        Exit Sub
    End If
    
    Form1.shpOK.BackColor = Green               ' set status to green
    Form1.lblStatus.Caption = "OK"              ' set OK
    
End Sub

Public Function OpenPort(PortName As String) As Boolean
' to open the port named PortName
Dim Res As Long
Dim NoOfDevs As Long
Dim I As Long
Dim Name As String
Dim DualName As String

    PortAIsOpen = False                         ' init to port not open
    OpenPort = False                            ' init to failure to open port
    Name = ""                                   ' set name to null
    DualName = PortName                         ' set which port we want to open
    NoOfDevs = GetFTDeviceCount                 ' get the number of devices
    If FT_Result <> FT_OK Then Exit Function    ' exit if failure
    
    ' try to find the requested port
    For I = 0 To NoOfDevs - 1
       Name = GetFTDeviceDescription(I)         ' get the device desctiption
       If Name = DualName Then Exit For         ' exit if this is the one
    Next
    
    If Name <> DualName Then Exit Function      ' exit if not found
    
    Res = Open_USB_Device_By_Description(DualName) ' open the device by its description
    If FT_Result <> FT_OK Then Exit Function    ' exit if failure
    
    Res = Get_USB_Device_QueueStatus            ' perform a test function on the port
    If FT_Result <> FT_OK Then Exit Function    ' exit if failure
    PortAIsOpen = True                          ' flag port as open
    OpenPort = True                             ' return open OK

End Function

Public Function Read_USB_Device_Buffer(Read_Count As Long) As Long
' Reads Read_Count bytes or less from the USB device to the FT_In_Buffer
' The function returns the number of bytes actually received which may range from zero
' to the actual number of bytes requested, depending on how many have been received
' at the time of the request + the read timeout value.
Dim Read_Result As Long

    If Read_Count = 1 Then Read_Result = Read_Count
    
    FT_IO_Status = FT_Read(FT_HANDLE, FT_In_Buffer, Read_Count, Read_Result)
    If FT_IO_Status <> FT_OK Then
        FT_Error_Report "FT_Read", FT_IO_Status
    End If
    Read_USB_Device_Buffer = Read_Result
    
End Function

Public Sub SendBytes(NumberOfBytes As Long)
Dim I As Long

    I = Write_USB_Device_Buffer(NumberOfBytes)
    OutIndex = OutIndex - I
    
End Sub

Public Function Set_USB_Device_BitMode(ucMask As Byte, ucEnable As Byte) As Long

    Set_USB_Device_BitMode = FT_SetBitMode(FT_HANDLE, ucMask, ucEnable)
    
End Function

Public Function Set_USB_Device_LatencyTimer(ucLatency As Byte) As Long

    Set_USB_Device_LatencyTimer = FT_SetLatencyTimer(FT_HANDLE, ucLatency)
    
End Function

Public Sub SetDeviceString(S As String)
' set the device name

    FT_Device_String_Buffer = S & Chr(0)
    
End Sub

Public Function Sync_To_MPSSE() As Boolean
' uses &HAA and &HAB commands which are invalid so that the MPSSE processor should
' echo these back to use preceded with &HFA
Dim Res As Long
Dim I As Long
Dim J As Long

    Sync_To_MPSSE = False
    
    ' clear anything in the input buffer
    Res = Get_USB_Device_QueueStatus
    If Res <> FT_OK Then Exit Function
    If FT_Q_Bytes > 0 Then
        ' read chunks of 'input buffer size'
        Do While FT_Q_Bytes > FT_In_Buffer_Size
            I = Read_USB_Device_Buffer(FT_In_Buffer_Size) ' read a chunk
            FT_Q_Bytes = FT_Q_Bytes - FT_In_Buffer_Size ' calculate bytes left
        Loop
        I = Read_USB_Device_Buffer(FT_Q_Bytes) ' read the final bytes
    End If
    
    ' put a bad command to the command processor
    OutIndex = 0 ' point to start of buffer
    AddToBuffer &HAA ' add a bad command
    SendBytes OutIndex  ' send to command processor
    ' wait for a response
    Do
        Res = Get_USB_Device_QueueStatus
    Loop Until (FT_Q_Bytes > 0) Or (Res <> FT_OK)
    If Res <> FT_OK Then Exit Function
    
    ' read the input queue
    I = Read_USB_Device_Buffer(FT_Q_Bytes) ' read the bytes
    For J = 1 To I
        If Mid(FT_In_Buffer, J, 1) = Chr(&HAA) Then
            Sync_To_MPSSE = True
            Exit Function
        End If
    Next
        
End Function

Public Sub TakeReading()
' take a single read of the ADC
Dim BitTest As Byte
Dim Res As Long
Dim Byte0 As Byte
Dim Byte1 As Byte
Dim I As Long
Dim Reading0 As Integer
Dim Reading1 As Integer
Dim LoopLimit As Integer

    ' set CS low to initiate a conversion in the MAX187 ADC
    Saved_Port_Value = Saved_Port_Value And &HF7    ' set CS=low
    AddToBuffer &H80                                ' Set data bits low byte command
    AddToBuffer CLng(Saved_Port_Value)
    AddToBuffer &HB                                 ' CS=output, DI=input, DO=output, SK=output
    SendBytes OutIndex                              ' send to command processor
    
    ' check for bad command
    Res = Get_USB_Device_QueueStatus
    If FT_Q_Bytes > 0 Or Res <> 0 Then
        Form1.shpOK.BackColor = Yellow
        Form1.lblStatus.Caption = "Possible bad command detected in procedure TakeReading when initiating an ADC conversion."
    End If
    
    ' wait for DI to go high - raised by DO on the MAX187 to signal conversion complete
    LoopLimit = 0                                   ' clear the limit counter
    Do
        AddToBuffer &H81                            ' read data bits low byte
        AddToBuffer &H87                            ' send back results immediately
        SendBytes OutIndex                          ' send to command processor
        LoopLimit = LoopLimit + 1
        Do
            Res = Get_USB_Device_QueueStatus '
        Loop Until (FT_Q_Bytes > 0) Or (Res <> FT_OK) ' wait for answer to be available
        If Res <> FT_OK Then
            Form1.shpOK.BackColor = Red
            StopReading = True
            Form1.lblStatus.Caption = "Get USB device queue status failed in procedureTakeReading."
            Exit Sub
        End If
        ' read the input queue
        I = Read_USB_Device_Buffer(FT_Q_Bytes)      ' read the byte
        BitTest = CByte(Asc(Mid(FT_In_Buffer, 1, 1))) And &H4 ' check if conversion complete
    Loop Until BitTest <> &H0 Or LoopLimit > 100
    
    If LoopLimit > 100 Then
        Form1.shpOK.BackColor = Yellow
        StopReading = True
        Form1.lblStatus.Caption = "No reading received - please check the ADC power is turned on."
    Else
        Form1.shpOK.BackColor = Green
        Form1.lblStatus.Caption = "OK"
    End If
    
    ' Clock data in. 2 bytes on -ve clock MSB first, no write
    AddToBuffer &H24                                ' read bytes on -ve clock MSB
    AddToBuffer &H1                                 ' LSB value 2
    AddToBuffer &H0                                 ' MSB value 0
    AddToBuffer &H87                                ' do it now
    SendBytes OutIndex
    ' wait for data to become available
    Do
        Res = Get_USB_Device_QueueStatus '
    Loop Until (FT_Q_Bytes > 0) Or (Res <> FT_OK)   ' wait for answer to be available
    If Res <> FT_OK Then
        Form1.shpOK.BackColor = Red
        StopReading = True
        Form1.lblStatus.Caption = "Get USB device queue status failed while waiting to read an ADC conversion."
        Exit Sub
    End If
    ' read the input queue
    I = Read_USB_Device_Buffer(FT_Q_Bytes)          ' read the bytes
    ' the MAX187 sends 1 start bit followed by 7 data bits in the first byte, then the
    ' remaining 5 data bits in the second byte. We must join the 2 together...
    Byte0 = CByte(Asc(Mid(FT_In_Buffer, 1, 1)))     ' convert to byte format
    Byte1 = CByte(Asc(Mid(FT_In_Buffer, 2, 1)))     ' convert to byte format
    Byte0 = Byte0 And &H7F                          ' drop the start bit put there by the MAX187
    Reading0 = Reading0 Or Byte0                    ' convert the MSB to integer
    Reading0 = Reading0 * 32                        ' shift left 5 bits
    Reading1 = Reading1 Or Byte1                    ' convert the LSB to integer
    Reading1 = Reading1 \ 8                         ' shift right 3 bits
    Reading = Reading0 + Reading1                   ' add both together
    
    ' turn CS high
    Saved_Port_Value = Saved_Port_Value Or &H8      ' set CS=high
    AddToBuffer &H80                                ' Set data bits low byte command
    AddToBuffer CLng(Saved_Port_Value)
    AddToBuffer &HB                                 ' CS=output, DI=input, DO=output, SK=output
    SendBytes OutIndex                              ' send to command processor
    
    ' check got a reading
    If Reading = 0 Then
        Form1.shpOK.BackColor = Yellow
        StopReading = True
        Form1.lblStatus.Caption = "No reading received - please check the ADC power is turned on."
        Exit Sub
    Else
        Form1.shpOK.BackColor = Green
        Form1.lblStatus.Caption = "OK"
    End If

End Sub

Public Function Write_USB_Device_Buffer(Write_Count As Long) As Long
Dim Write_Result As Long

    FT_IO_Status = FT_Write(FT_HANDLE, FT_Out_Buffer, Write_Count, Write_Result)
    If FT_IO_Status <> FT_OK Then FT_Error_Report "FT-Write", FT_IO_Status
    Write_USB_Device_Buffer = Write_Result
    
End Function

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品人人做人人爽人人| 一区二区三区国产豹纹内裤在线| 久久精品人人做| 伊人性伊人情综合网| 国产在线精品免费| 2020国产精品久久精品美国| 91久久国产最好的精华液| 91精品国产综合久久久久久久久久 | 精品一二三四在线| 欧亚一区二区三区| 中文字幕一区二区三区av| 精品一区免费av| 51精品秘密在线观看| 亚洲另类在线一区| 成人激情av网| 中文在线资源观看网站视频免费不卡| 免费观看日韩av| 欧美一区二区性放荡片| 亚洲一区二区四区蜜桃| 波多野结衣欧美| 国产精品三级在线观看| 国产乱码精品一品二品| 欧美成人一级视频| 奇米888四色在线精品| 欧美色视频在线| 一区二区免费在线| 一本大道久久a久久综合| 亚洲婷婷在线视频| 色综合色狠狠综合色| 专区另类欧美日韩| 99久久综合国产精品| 国产精品网站在线播放| 成人一区二区视频| 久久久久久久久久电影| 精彩视频一区二区三区| 日韩女优电影在线观看| 麻豆精品国产传媒mv男同| 欧美一区二区免费视频| 看片网站欧美日韩| 久久在线免费观看| 国产成人福利片| 国产精品国产三级国产专播品爱网| 成人免费视频一区| 亚洲欧洲在线观看av| 91原创在线视频| 一区二区成人在线| 欧美影院午夜播放| 日韩精品乱码免费| 精品久久一区二区| 成人黄色综合网站| 亚洲精品菠萝久久久久久久| 欧美艳星brazzers| 免费观看一级欧美片| 久久久久国产精品人| 99国产精品国产精品毛片| 亚洲最大的成人av| 日韩精品影音先锋| 成人av高清在线| 天堂精品中文字幕在线| 精品国产乱码久久久久久久久 | 欧美bbbbb| 国产性天天综合网| 欧美怡红院视频| 久久不见久久见中文字幕免费| 欧美激情资源网| 欧美日韩美女一区二区| 国产自产高清不卡| 亚洲国产精品一区二区久久| 欧美成人在线直播| 色婷婷激情久久| 国产一区二区三区在线观看精品| 亚洲欧洲色图综合| 日韩亚洲欧美在线| 99久久伊人精品| 成人福利电影精品一区二区在线观看| 亚洲欧洲制服丝袜| 精品免费99久久| 在线欧美日韩国产| 丰满放荡岳乱妇91ww| 日韩电影免费在线看| 中文字幕欧美一区| 欧美va日韩va| 在线91免费看| 色综合久久综合网欧美综合网| 美女视频网站黄色亚洲| 亚洲丝袜美腿综合| 精品成人一区二区三区| 欧美制服丝袜第一页| 成人国产在线观看| 激情欧美一区二区| 天天操天天色综合| 一区二区三区在线免费| 国产精品美女久久久久av爽李琼| 日韩欧美在线影院| 精品视频一区 二区 三区| 99re6这里只有精品视频在线观看 99re8在线精品视频免费播放 | 日韩欧美亚洲一区二区| 色综合色狠狠天天综合色| 国产成人综合在线播放| 九九久久精品视频| 五月婷婷色综合| 洋洋av久久久久久久一区| 中文字幕第一区二区| 久久久久久久久久看片| 日韩丝袜情趣美女图片| 欧美一区二区日韩一区二区| 精品1区2区3区| 在线精品视频免费播放| 一本色道久久加勒比精品| 99在线热播精品免费| 风间由美中文字幕在线看视频国产欧美| 久久精品国产秦先生| 捆绑调教一区二区三区| 蜜桃视频免费观看一区| 青草国产精品久久久久久| 奇米影视一区二区三区| 日本不卡高清视频| 日本不卡1234视频| 蜜乳av一区二区| 成人激情图片网| 成人毛片视频在线观看| aaa国产一区| 色乱码一区二区三区88| 在线观看一区二区精品视频| 欧美日免费三级在线| 69堂国产成人免费视频| 日韩欧美一区二区免费| 26uuu色噜噜精品一区二区| 久久女同互慰一区二区三区| 国产午夜精品久久| 中文字幕亚洲欧美在线不卡| 一区二区三区日韩| 日韩精品一区第一页| 激情综合色综合久久| 成人听书哪个软件好| 在线视频国产一区| 欧美日韩dvd在线观看| 精品av久久707| 日韩美女视频一区二区| 亚洲国产日韩一级| 国产综合久久久久久久久久久久| 不卡区在线中文字幕| 欧美亚洲一区二区在线| 精品免费国产一区二区三区四区| 日本一二三不卡| 亚洲福中文字幕伊人影院| 极品少妇一区二区三区精品视频| 波多野结衣在线一区| 欧美日韩精品一区二区在线播放| 精品日韩一区二区三区免费视频| 国产精品久久777777| 三级在线观看一区二区| 国产高清不卡一区二区| 欧洲国内综合视频| 国产日韩成人精品| 亚洲午夜精品久久久久久久久| 久久电影网站中文字幕| 91香蕉视频污| 精品噜噜噜噜久久久久久久久试看| 国产精品久久久久影院亚瑟| 国产在线播放一区三区四| 色综合 综合色| 久久免费视频色| 亚洲电影在线免费观看| 国产黑丝在线一区二区三区| 在线视频一区二区免费| 欧美国产97人人爽人人喊| 婷婷久久综合九色综合伊人色| 粉嫩嫩av羞羞动漫久久久| 欧美一区二区久久| 亚洲欧洲av色图| 国产精品综合二区| 在线电影院国产精品| 亚洲天天做日日做天天谢日日欢| 国产又粗又猛又爽又黄91精品| 在线免费观看一区| 欧美高清在线一区| 国产精品一区二区男女羞羞无遮挡| 欧美夫妻性生活| 亚洲黄色小视频| 91在线观看地址| 国产精品久久久久久久久搜平片| 精品一区精品二区高清| 欧美三级视频在线播放| 国产精品每日更新| 国产美女娇喘av呻吟久久| 日韩视频一区在线观看| 日韩专区欧美专区| 欧美日韩亚洲丝袜制服| 夜夜嗨av一区二区三区四季av| 99re这里只有精品6| 中文乱码免费一区二区| 国产精品资源网站| 欧美精品一区二区精品网| 另类小说视频一区二区| 日韩一二三区视频| 免费av成人在线| 精品国产123| 国产精品一区免费在线观看| 国产亚洲精品中文字幕|