⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uhf_analysis.frm

📁 M8演示程序
💻 FRM
📖 第 1 页 / 共 5 页
字号:
    Form1.Response$ = ""
    Form1.MSComm1.Output = vbCr & flags$ & comand$ & strtBlk$ & nbBlks$ & dacVal$ & crc$ & vbCr
    ''wait .1 second to give the reader time to process the command before it responds
    Start = Timer
    Do
    Loop Until (Timer - Start) > 0.2
    If Form1.GetResponse() = False Then
        'label_Status.Caption = "Waiting for Command"
        'textbox_ModDepth.Text = "<Write Fail>"
        WriteMod = False
        Exit Function
    Else
        If Mid(Form1.Response$, 2, 2) <> comand$ Then
            'label_Status.Caption = "Waiting for Command"
            'textbox_ModDepth.Text = "<Write Fail>"
            WriteMod = False
            Exit Function
        End If
    End If
    '' the write mem (write sys) command passed.
End Function

Private Function Read_Tag()
    
    Dim respBytes As Integer
    Dim TagID As String
    Dim crlfPosition As Integer
    
    TagRead = False
    
    'labelStatus.Caption = "Reading a Tag"


    Form1.Response$ = ""
    
   ' textClass1.Text = ""
   ' textClass0.Text = ""
    
    If Form1.MSComm1.PortOpen = False Then
        Exit Function
    End If
    

    
    
    Form1.MSComm1.InBufferCount = 0
   ' If checkLoop.Value = 1 Then
   '    Form1.demoLOOP = True

   '     If optionClass1.Value = True Then
   '         Form1.MSComm1.Output = vbCr & "011481" & vbCr
   '     Else
   '         Form1.MSComm1.Output = vbCr & "011482" & vbCr
   '     End If
   '
   '     Start = Timer
   '     Do
   '     Loop Until (Timer - Start) > 0.1
   '     If Form1.GetResponse() = True Then
   '         If Mid(Form1.Response, 2, 2) <> "1C" Then'
   
   '    Exit Sub
   '         End If

   '     End If

        ' Now enable the OnComm Events
   '     Form1.MSComm1.RThreshold = 1  'Now enable OnComm to handle Loop Mode
       
   ' Else
    
        ' Diasble the OnComm Events
        Form1.MSComm1.RThreshold = 0  ' disable OnComm
        Form1.MSComm1.InBufferCount = 0 ' clear the rx buffer in case a tag id was coming through just as we get here
        Form1.Response$ = ""
        ' Send the Command
        
        If optionClass1.Value = True Then
            Form1.MSComm1.Output = vbCr & "001481" & vbCr
        Else
            If optionClass0.Value = True Then
                Form1.MSComm1.Output = vbCr & "081482" & vbCr
            Else
                If optionClass1Gen2 = True Then
                    Form1.MSComm1.Output = vbCr & "001487" & vbCr
                Else
                    Form1.MSComm1.Output = vbCr & "081486" & vbCr
                End If
            End If
        End If
        
        Form1.MSComm1.InBufferCount = 0
        
        ' wait .1 second to give the reader time to process the command before it responds
        Start = Timer
        Do
        Loop Until (Timer - Start) > 0.1
        
            If Form1.GetResponse() = True Then
                ' Good tag response
                If Mid(Form1.Response, 2, 2) = "14" Then
                   
                   TagRead = True
                                                                
                    'labelStatus.Caption = "Waiting For Command"
                    Exit Function
                    
                    
                Else
                                          
                   TagRead = False
    
                End If
        
         End If
    
        
    ' End If

    
End Function

Private Function Write_Tag()
    
    TagWrite = False
    TagErase = False
    Dim Start As Single

    Form1.Response$ = ""
    'Form1.MSComm1.Output = vbCr & flags$ & comand$ & strtBlk$ & nbBlks$ & hexLong$ & crc$ & vbCr
    

    
    If Form1.MSComm1.PortOpen = False Then
        Exit Function
    End If
    
    
 ' Diasble the OnComm Events
        Form1.MSComm1.RThreshold = 0  ' disable OnComm
        Form1.MSComm1.InBufferCount = 0 ' clear the rx buffer in case a tag id was coming through just as we get here
        Form1.Response$ = ""
        ' Send the Command
        
        ' ******* Class 1 Write ************
        If optionClass1.Value = True Then
        
            Call Erase_Tag
            If TagErase = False Then
            
            Exit Function
         
            End If
            
            ' Write Tag
            If check96.Value = True Then
                '96 bit tag - Send Command
                Form1.MSComm1.Output = vbCr & "004481000C" & "FFFFFFFFFFFFFFFFFFFFFFFF" & vbCr
        
            Else
                '64 bit tag - Send Command
                Form1.MSComm1.Output = vbCr & "0044810008" & "FFFFFFFFFFFFFFFF" & vbCr
            End If
        
        
            Form1.MSComm1.InBufferCount = 0
        

            ' wait .1 second to give the reader time to process the command before it responds
            Start = Timer
        
            Do
            Loop Until (Timer - Start) > 0.5
        
                If Form1.GetResponse() = True Then
                    ' Good tag response
                    If Mid(Form1.Response, 2, 2) = "44" Then
                        TagWrite = True
                    
                        ' labelStatus.Caption = "Write Passed: Waiting For Command"
                    Else
                        TagWrite = False
                    
                        ' Failed to Write
                        ' labelStatus.Caption = "Write Failed: Waiting For Command"
                        ' textClass0.Text = Mid(Form1.Response, 2, 2)
           
                    End If
                
        
                End If
        End If
        ' ********* End Class 1 Write ************
        
        
        ' ********* Class 0 impinj Write ************
        ' Impinj Class 0 write does not require an erase command
        If optionClass0.Value = True Then
        
        ' Write Tag
            Form1.MSComm1.Output = vbCr & "084483000C" & "FFFFFFFFFFFFFFFFFFFFFFFF" & vbCr
        
            Form1.MSComm1.InBufferCount = 0
        

            ' wait .1 second to give the reader time to process the command before it responds
            Start = Timer
        
            Do
            Loop Until (Timer - Start) > 0.5
        
                If Form1.GetResponse() = True Then
                    ' Good tag response
                    If Mid(Form1.Response, 2, 2) = "44" Then
                        TagWrite = True
                    
                        ' labelStatus.Caption = "Write Passed: Waiting For Command"
                    Else
                        TagWrite = False
                    
                        ' Failed to Write
                        ' labelStatus.Caption = "Write Failed: Waiting For Command"
                        ' textClass0.Text = Mid(Form1.Response, 2, 2)
           
                    End If
                
        
                End If
        End If
        ' ********* End Class 0+ impinj Write ************
    
        ' ********* Class 1 Gen2 Write ************
        ' Class 1 Gen2 write does not require an erase command
        If optionClass1Gen2.Value = True Then
        
        ' Write Tag
            Form1.MSComm1.Output = vbCr & "004487020D" & "0111223344556677889900AABB" & vbCr
        
            Form1.MSComm1.InBufferCount = 0
        

            ' wait .1 second to give the reader time to process the command before it responds
            Start = Timer
        
            Do
            Loop Until (Timer - Start) > 0.5
        
                If Form1.GetResponse() = True Then
                    ' Good tag response
                    If Mid(Form1.Response, 2, 2) = "44" Then
                        TagWrite = True
                    
                        ' labelStatus.Caption = "Write Passed: Waiting For Command"
                    Else
                        TagWrite = False
                    
                        ' Failed to Write
                        ' labelStatus.Caption = "Write Failed: Waiting For Command"
                        ' textClass0.Text = Mid(Form1.Response, 2, 2)
           
                    End If
                
        
                End If
        End If
        ' ********* End Class 1 Gen2 Write ************
    
        ' ********* ISO 18000-6B Write ************
        ' Class 1 Gen2 write does not require an erase command
        'If optionClass1Gen2.Value = True Then
        '
        ' Write Tag
        '    Form1.MSComm1.Output = vbCr & "004487020D" & "0111223344556677889900AABB" & vbCr
        '
        '   Form1.MSComm1.InBufferCount = 0
        '
        '
        '    ' wait .1 second to give the reader time to process the command before it responds
        '    Start = Timer
        '
        '   Do
        '    Loop Until (Timer - Start) > 0.5
        '
        '        If Form1.GetResponse() = True Then
        '            ' Good tag response
        '            If Mid(Form1.Response, 2, 2) = "44" Then
        '                TagWrite = True
        '
        '                ' labelStatus.Caption = "Write Passed: Waiting For Command"
        '            Else
        '                TagWrite = False
        '
        '                ' Failed to Write
        '                ' labelStatus.Caption = "Write Failed: Waiting For Command"
        '                ' textClass0.Text = Mid(Form1.Response, 2, 2)
        '
        '            End If
        '
        '
        '        End If
        'End If
        ' ********* End ISO 18000-6B Write ************
    
    
End Function
Private Function Erase_Tag()

    
    TagErase = False

    Form1.Response$ = ""
    'Form1.MSComm1.Output = vbCr & flags$ & comand$ & strtBlk$ & nbBlks$ & hexLong$ & crc$ & vbCr
    

    
    If Form1.MSComm1.PortOpen = False Then
        Exit Function
    End If
    
    
 ' Diasble the OnComm Events
        Form1.MSComm1.RThreshold = 0  ' disable OnComm
        Form1.MSComm1.InBufferCount = 0 ' clear the rx buffer in case a tag id was coming through just as we get here
        Form1.Response$ = ""
        ' Send the Command
        
        
        ' Erase Tag *************************************************************************
        If check96.Value = True Then
            '96 bit tag - Send Command
            Form1.MSComm1.Output = vbCr & "0044810000" & vbCr
        
        Else
            '64 bit tag - Send Command
            Form1.MSComm1.Output = vbCr & "0044810000" & vbCr
        End If
        
        
        Form1.MSComm1.InBufferCount = 0
        
        Dim Start As Single
        ' wait .1 second to give the reader time to process the command before it responds
        Start = Timer
        
        Do
        Loop Until (Timer - Start) > 0.5
        
            If Form1.GetResponse() = True Then
                ' Good tag response
                If Mid(Form1.Response, 2, 2) = "44" Then
                    TagErase = True
                    
                    ' labelStatus.Caption = "Write Passed: Waiting For Command"
                Else
                    TagErase = False

                    ' Failed to Write
                    ' labelStatus.Caption = "Write Failed: Waiting For Command"
                    ' textClass0.Text = Mid(Form1.Response, 2, 2)
           
                End If
                
        
            End If

End Function
Private Function Freq_Hopping_Off()
  
    flags$ = "20"   ' set the CRC_F
    comand$ = "42" ' Assume this is a Write_Sys command
    
    nbBlks$ = "01"
    
    strtBlk$ = "13"

    dacVal$ = "02" ' disable freq hopping
    
    ''send the Write_Sys comand$ (41 or 42) to write pwrData$ into startBlk$
    crc$ = Form1.calculateCRC(flags$ & comand$ & strtBlk$ & nbBlks$ & dacVal$)
    Form1.Response$ = ""
    Form1.MSComm1.Output = vbCr & flags$ & comand$ & strtBlk$ & nbBlks$ & dacVal$ & crc$ & vbCr
    ''wait .1 second to give the reader time to process the command before it responds
    Start = Timer
    Do
    Loop Until (Timer - Start) > 0.2
    If Form1.GetResponse() = False Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -