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

📄 uhf_analysis.frm

📁 M8演示程序
💻 FRM
📖 第 1 页 / 共 5 页
字号:
Private longTemp As Long

Dim newPwrData As Double
Private retPwrData$
Dim newModVal As Integer

Dim typeOfTag As String
Dim getTIDFlag As Boolean
Dim protocolv2 As Boolean
Dim timeOut As Double
Dim ie As InternetExplorer

Public TagRead As Boolean
Public TagWrite As Boolean
Public TagErase As Boolean

Public WriteFreq As Boolean
Public WritePwr As Boolean
Public WriteMod As Boolean

Public StopTest As Boolean



Private Sub Btn_browse_Click()

    CommonDialog1.Filter = "All Text Files|*.txt"
    ' Specify default filter.
    
    CommonDialog1.DialogTitle = "Change Output File"
    CommonDialog1.FileName = ""
    'CommonDialog1.FilterIndex = 2  ' Display the Open dialog box.
    
    CommonDialog1.ShowOpen
    ' Call the open file procedure.
    If CommonDialog1.FileName = "" Then
        Exit Sub
    End If

    'first put the new association into the array in RAM
    FileNamePath = CommonDialog1.FileName
    BrowseFileName$ = CommonDialog1.FileName
    'Linedata(1) = "logo=" & FileName(1)
    UHF_Analysis.Text_OutputFilePath.Text = FileNamePath
    
    
End Sub

Private Sub Btn_Start_Click()
    ' Define variables
    Dim PwrCnt As Integer
    Dim MaxPwrCnt As Integer
    Dim FreqCnt As Integer
    Dim MaxFreqCnt As Integer
    Dim FreqLoop As Double
    Dim PwrLoop As Double
    Dim Rate As Double
    Dim RateCnt As Integer
    Dim RateLoops As Integer
    
    Btn_Start.Enabled = False
    StopTest = False

    ' Check for output file path
    If CommonDialog1.FileName = "" Then
        ' Browse for file
        CommonDialog1.Filter = "All Text Files|*.txt"
        ' Specify default filter.
    
        CommonDialog1.DialogTitle = "Change Output File"
        CommonDialog1.FileName = ""
        'CommonDialog1.FilterIndex = 2  ' Display the Open dialog box.
    
        CommonDialog1.ShowOpen
        ' Call the open file procedure.
        If CommonDialog1.FileName = "" Then
            Exit Sub
        End If

        ' store output file path as string and function
        FileNamePath = CommonDialog1.FileName
        BrowseFileName$ = CommonDialog1.FileName
    
        ' display output file path
        UHF_Analysis.Text_OutputFilePath.Text = FileNamePath
    End If
        
        
    ' open output file
    Open BrowseFileName$ For Output As #1
            
    ' Print Header
    Print #1, "Frequency, Power level, Passing Rate"
    
    'Send command to Freq hopping off
    Call Freq_Hopping_Off
    
    
    ' Set initial Freq and Power Values
    Call Write_Frequency
    If WriteFreq = False Then
        Call Write_Frequency
        If WriteFreq = False Then
            MsgBox "Failed to write initial freq to reader"
        End If
    End If
   
    Call Write_Power
    If WritePwr = False Then
        Call Write_Power
        If WritePwr = False Then
            MsgBox "Failed to write initial power to reader"
        End If
    End If
   
    Call Write_Mod_Depth
    If WriteMod = False Then
        Call Write_Mod_Depth
        If WriteMod = False Then
            MsgBox "Failed to write initial modulation depth to reader"
        End If
    End If
 
    
    FreqCnt = 0
    PwrCnt = 0
    RateLoops = Val(numTries.Text)

    ' Run Test
    If optionReadTag = True Then
        ' if max power = min power = start power => power fixed
        ' if max freq = min freq = start freq => freq fixed
        
        
        ' Determin Loop Counts
        FreqLoop = (CDbl(UHF_Analysis.textbox_MaxFreq.Text) - CDbl(UHF_Analysis.textbox_MinFreq.Text)) / ((CDbl(UHF_Analysis.textbox_StepFreq.Text)) / 1000)
        PwrLoop = (CDbl(UHF_Analysis.textbox_MaxPwr.Text) - CDbl(UHF_Analysis.textbox_MinPwr.Text)) / CDbl(UHF_Analysis.textbox_StepPwr.Text)

        ' Write Initial Freq and Pwr Values
       Call Write_Frequency
       If WriteFreq = False Then
            Call Write_Frequency
            If WriteFreq = False Then
                MsgBox "Failed to write freq to reader"
            End If
       End If
       
       Call Write_Power
       If WritePwr = False Then
            Call Write_Power
            If WritePwr = False Then
                MsgBox "Failed to write power to reader"
            End If
       End If
        
        ' Enter loop - adjust freq and power for each read - output to file
        Do Until FreqCnt = (FreqLoop + 1)
        
            Do Until PwrCnt = (PwrLoop + 1)
            
                For i = 0 To (RateLoops - 1)
                    
                    ' Try to Read Tag
                    Call Read_Tag
                    If TagRead = True Then
                        RateCnt = RateCnt + 1
                    End If
                    
                Next
                
                Rate = RateCnt / RateLoops
                RateCnt = 0
                    
                Print #1, UHF_Analysis.textbox_Freq.Text & "," & UHF_Analysis.textbox_Pwr.Text & "," & (Rate * 100) ' Print loop #, Freq, Power, Read
            
                If StopTest = True Then
                    Exit Sub
                End If
                    
                ' incr Freq and/or power
                ' textbox_Pwr.Text = "12"
                ' textbox_Freq.Text = "928.000"
      
                
                textbox_Pwr.Text = FormatNumber(Str(CDbl(textbox_Pwr.Text) + CDbl(textbox_StepPwr.Text)), 1)
                PwrCnt = PwrCnt + 1
                Call Write_Power
                If WritePwr = False Then
                    Call Write_Power
                    If WritePwr = False Then
                        MsgBox "Failed to write power to reader"
                    End If
                End If
            Loop
            
            textbox_Freq.Text = FormatNumber(Str(CDbl(textbox_Freq.Text) + (CDbl(textbox_StepFreq.Text) / 1000)), 3)
            FreqCnt = FreqCnt + 1
            
            ' Reset loop parameters
            If CDbl(UHF_Analysis.textbox_MaxPwr.Text) = CDbl(UHF_Analysis.textbox_MinPwr.Text) Then
                textbox_Pwr.Text = UHF_Analysis.textbox_MaxPwr.Text
            Else
                textbox_Pwr.Text = "12.0"
            End If
            
            PwrCnt = 0
            Call Write_Frequency
            If WriteFreq = False Then
                Call Write_Frequency
                If WriteFreq = False Then
                    MsgBox "Failed to write freq to reader"
                End If
            End If
        Loop
        
        ' Reset loop parameters
        If CDbl(UHF_Analysis.textbox_MaxFreq.Text) = CDbl(UHF_Analysis.textbox_MinFreq.Text) Then
           textbox_Freq.Text = UHF_Analysis.textbox_MaxFreq.Text
        Else
           textbox_Freq.Text = "902.000"
        End If
        
        
    

    ElseIf optionWriteTag = True Then
    
        ' Determin Loop Counts
        FreqLoop = (CDbl(UHF_Analysis.textbox_MaxFreq.Text) - CDbl(UHF_Analysis.textbox_MinFreq.Text)) / ((CDbl(UHF_Analysis.textbox_StepFreq.Text)) / 1000)
        PwrLoop = (CDbl(UHF_Analysis.textbox_MaxPwr.Text) - CDbl(UHF_Analysis.textbox_MinPwr.Text)) / CDbl(UHF_Analysis.textbox_StepPwr.Text)

        ' Write Initial Freq and Pwr Values
       Call Write_Frequency
       If WriteFreq = False Then
            Call Write_Frequency
            If WriteFreq = False Then
                MsgBox "Failed to write freq to reader"
            End If
       End If
       
       Call Write_Power
       If WritePwr = False Then
            Call Write_Power
            If WritePwr = False Then
                MsgBox "Failed to write power to reader"
            End If
       End If
        
        ' Enter loop - adjust freq and power for each read - output to file
        Do Until FreqCnt = (FreqLoop + 1)
        
            Do Until PwrCnt = (PwrLoop + 1)
            
                For i = 0 To (RateLoops - 1)
                    
                    ' Try to Read Tag
                    Call Write_Tag
                    If TagWrite = True Then
                        RateCnt = RateCnt + 1
                    End If
                    
                Next
                
                Rate = RateCnt / RateLoops
                RateCnt = 0
                    
                Print #1, UHF_Analysis.textbox_Freq.Text & "," & UHF_Analysis.textbox_Pwr.Text & "," & (Rate * 100) ' Print loop #, Freq, Power, Read
              
                If StopTest = True Then
                    Exit Sub
                End If
                                  
                ' incr Freq and/or power
                ' textbox_Pwr.Text = "12"
                ' textbox_Freq.Text = "928.000"
      
                
                textbox_Pwr.Text = FormatNumber(Str(CDbl(textbox_Pwr.Text) + CDbl(textbox_StepPwr.Text)), 1)
                PwrCnt = PwrCnt + 1
                Call Write_Power
                If WritePwr = False Then
                    Call Write_Power
                    If WritePwr = False Then
                        MsgBox "Failed to write power to reader"
                    End If
                End If
            Loop
            
            textbox_Freq.Text = FormatNumber(Str(CDbl(textbox_Freq.Text) + (CDbl(textbox_StepFreq.Text) / 1000)), 3)
            FreqCnt = FreqCnt + 1
            
            ' Reset loop parameters
            If CDbl(UHF_Analysis.textbox_MaxPwr.Text) = CDbl(UHF_Analysis.textbox_MinPwr.Text) Then
                textbox_Pwr.Text = UHF_Analysis.textbox_MaxPwr.Text
            Else
                textbox_Pwr.Text = "12.0"
            End If
            
            PwrCnt = 0
            Call Write_Frequency
            If WriteFreq = False Then
                Call Write_Frequency
                If WriteFreq = False Then
                    MsgBox "Failed to write freq to reader"
                End If
            End If
        Loop
        ' Reset loop parameters
        If CDbl(UHF_Analysis.textbox_MaxFreq.Text) = CDbl(UHF_Analysis.textbox_MinFreq.Text) Then
           textbox_Freq.Text = UHF_Analysis.textbox_MaxFreq.Text
        Else
           textbox_Freq.Text = "902.000"
        End If
        

    ElseIf optionEraseTag = True Then

        ' Determin Loop Counts
        FreqLoop = (CDbl(UHF_Analysis.textbox_MaxFreq.Text) - CDbl(UHF_Analysis.textbox_MinFreq.Text)) / ((CDbl(UHF_Analysis.textbox_StepFreq.Text)) / 1000)
        PwrLoop = (CDbl(UHF_Analysis.textbox_MaxPwr.Text) - CDbl(UHF_Analysis.textbox_MinPwr.Text)) / CDbl(UHF_Analysis.textbox_StepPwr.Text)

        ' Write Initial Freq and Pwr Values
       Call Write_Frequency
       Call Write_Power
        
        ' Enter loop - adjust freq and power for each read - output to file
        Do Until FreqCnt = (FreqLoop + 1)
        
            Do Until PwrCnt = (PwrLoop + 1)
            
                For i = 0 To (RateLoops - 1)
                    
                    ' Try to Read Tag
                    Call Erase_Tag
                    If TagErase = True Then
                        RateCnt = RateCnt + 1
                    End If
                    
                Next
                
                Rate = RateCnt / RateLoops
                RateCnt = 0
                    
                Print #1, UHF_Analysis.textbox_Freq.Text & "," & UHF_Analysis.textbox_Pwr.Text & "," & (Rate * 100) ' Print loop #, Freq, Power, Read
            
                If StopTest = True Then
                    Exit Sub
                End If
                                 
              
                ' incr Freq and/or power
                ' textbox_Pwr.Text = "12"
                ' textbox_Freq.Text = "928.000"
      
                
                textbox_Pwr.Text = FormatNumber(Str(CDbl(textbox_Pwr.Text) + CDbl(textbox_StepPwr.Text)), 1)
                PwrCnt = PwrCnt + 1
                Call Write_Power
                If WritePwr = False Then
                    Call Write_Power
                    If WritePwr = False Then
                        MsgBox "Failed to write power to reader"
                    End If
                End If
            Loop
            
            textbox_Freq.Text = FormatNumber(Str(CDbl(textbox_Freq.Text) + (CDbl(textbox_StepFreq.Text) / 1000)), 3)
            FreqCnt = FreqCnt + 1
            
            ' Reset loop parameters
            If CDbl(UHF_Analysis.textbox_MaxPwr.Text) = CDbl(UHF_Analysis.textbox_MinPwr.Text) Then
                textbox_Pwr.Text = UHF_Analysis.textbox_MaxPwr.Text
            Else
                textbox_Pwr.Text = "12.0"
            End If
            
            
            PwrCnt = 0
            Call Write_Frequency
            If WriteFreq = False Then
                Call Write_Frequency
                If WriteFreq = False Then
                    MsgBox "Failed to write freq to reader"
                End If
            End If
        Loop

⌨️ 快捷键说明

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