prjbas.bas

来自「电梯检测系统是对电梯性能进行检测的系统。是一个用来学习的程序。」· BAS 代码 · 共 1,871 行 · 第 1/5 页

BAS
1,871 行
字号
      Exit Function
    End If
    DoEvents
  Loop
  'set DREC-D to 0
  CurSendSucc = False
  cTime = Timer
  Do Until Timer - cTime > 2
    If bolWritePlcB_05(iDeviceID, DREC_DAddr, &H0) Then
      CurSendSucc = True
      ButtonImg(4).Picture = LoadPicture(App.Path & "\button\Lightbutton-B.gif")
      TitleLabel(11).ForeColor = &HC0C0C0
      Exit Do
    End If
  Loop
  
  'JREC
  FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now turn JREC to normal mode." & Chr(10) & Chr(13)
  'send JREC to 0
  CurSendSucc = False
  cTime = Timer
  Do Until Timer - cTime > 2
   If bolWritePlcB_05(iDeviceID, JRECAddr, &H0) Then
     ButtonImg(10).Picture = LoadPicture(App.Path & "\button\rightbutton.GIF")
     TitleLabel(15).ForeColor = &HC0C0C0
     CurSendSucc = True
     Exit Do
   End If
  Loop
  JRECTstSta = False
  'detect KNE
  'If SignalBitRight(LngVRetAryB, 8, 1) Then  'KNE

  
  FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "If all are right, click Yes commandbutton,Or click No commandbutton." & Chr(10) & Chr(13)
  Do Until YesCmdClick
    DoEvents
  Loop
  If FuncTestPass Then
    FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Inspection Trip Complished!" & Chr(10) + Chr(13)
    InspectionTrip = True
  Else
    FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Inspection Trip failed!" & Chr(10) + Chr(13)
    InspectionTrip = False
  End If
End Function
Public Function InstallationTrip() As Boolean
 
 Dim cTime
 Dim CurSendSucc As Boolean
  'FrmFuncTest.ButtonImg(1).Visible = False      'DREC-U  frame2(2)
  'FrmFuncTest.TitleLabel(13).Visible = False
  'FrmFuncTest.ButtonImg(2).Visible = False      'JHC     frame2(2)
  'FrmFuncTest.TitleLabel(12).Visible = False
  'FrmFuncTest.ButtonImg(3).Visible = True      'JRH     frame2(0)
  'FrmFuncTest.TitleLabel(14).Visible = True
  'FrmFuncTest.ButtonImg(4).Visible = False      'DREC-D  frame2(2)
  'FrmFuncTest.TitleLabel(11).Visible = False
  'FrmFuncTest.ButtonImg(9).Visible = True      'DRH-D   frame2(0)
  'FrmFuncTest.TitleLabel(18).Visible = True
  'FrmFuncTest.ButtonImg(10).Visible = False     'JREC    frame2(2)
  'FrmFuncTest.TitleLabel(15).Visible = False
  'FrmFuncTest.ButtonImg(11).Visible = False     'JHMD    frame2(0)
  'FrmFuncTest.TitleLabel(17).Visible = False
  'FrmFuncTest.ButtonImg(12).Visible = True     'DRH-U   frame2(0)
  'FrmFuncTest.TitleLabel(16).Visible = True
  FrmFuncTest.Frame2(0).Visible = True
  FrmFuncTest.Frame2(2).Visible = False
 ' FrmFuncTest.Frame2(1).Visible = False
  FrmFuncTest.BackLabel(0).Visible = True
  FrmFuncTest.BackLabel(5).Visible = False
 ' FrmFuncTest.BackLabel(4).Visible = False
  SendComp = False
  SendSucc = False
  JRHcomp = False
  DRH_Ucomp = False
  DRH_Dcomp = False
  
  InstallationTrip = True
  
  FrmFuncTest.TripLabel.Caption = "Installation Trip"
  'send JRH
  FrmFuncTest.TestText.Text = "Now turn JRH to the check mode." & Chr(10)
  If JRHTstSta Then
    FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now the JRH is in check mode,you do not need to turn." & Chr(10)
  Else
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, JRHAddr, &HFF) Then
       FrmFuncTest.ButtonImg(3).Picture = LoadPicture(App.Path & "\button\leftbutton.GIF")
       FrmFuncTest.TitleLabel(14).ForeColor = &HC000&
       CurSendSucc = True
       JRHTstSta = True
       
     End If
   
   If Not CurSendSucc Then
     FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
     InstallationTrip = False
     Exit Function
   End If
  End If
  
   
     
        'send DRH-U
   FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now send DRH-U signal." & Chr(10)
   ' set DRH-U to 1
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_UAddr, &HFF) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(12).Picture = LoadPicture(App.Path & "\button\ballgreen-on.GIF")
       FrmFuncTest.TitleLabel(16).ForeColor = &HC000&
     End If
   
   If Not CurSendSucc Then
     FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
     InstallationTrip = False
     Exit Function
   End If
   'Waiting for one Com interval
   'cTime = Timer
   'Do Until Timer - cTime > CommInterv / 200
   '  DoEvents
   'Loop
   'Waiting for one second
   cTime = Timer
   Do Until Timer - cTime > 2
     DoEvents
   Loop

     If Not NowMoveFx = "U" Then
       FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Error in move direction,exit test."
       InstallationTrip = False
         'set JRH to 0
         CurSendSucc = False
           If bolWritePlcB_05(iDeviceID, JRHAddr, &H0) Then
             CurSendSucc = True
             FrmFuncTest.ButtonImg(3).Picture = LoadPicture(App.Path & "\button\rightbutton.GIF")
             FrmFuncTest.TitleLabel(14).ForeColor = &HC0C0C0
             
             JRHTstSta = False
           End If
        'set DRH_U to 0
        CurSendSucc = False
          If bolWritePlcB_05(iDeviceID, DRH_UAddr, &H0) Then
            CurSendSucc = True
            FrmFuncTest.ButtonImg(12).Picture = LoadPicture(App.Path & "\button\Ballgreen.GIF")
            FrmFuncTest.TitleLabel(16).ForeColor = &HC0C0C0
            
          End If
       Exit Function
     End If
   ' set DRH-U to 0
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_UAddr, &H0) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(12).Picture = LoadPicture(App.Path & "\button\Ballgreen.GIF")
       FrmFuncTest.TitleLabel(16).ForeColor = &HC0C0C0
       
     End If
   FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Move in correct direction." & Chr(10)
    
  'send DRH-D
   FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now send DRH-D signal." & Chr(10)
   ' set DRH-D to 1
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_DAddr, &HFF) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(9).Picture = LoadPicture(App.Path & "\button\ballblue-on.GIF")
       FrmFuncTest.TitleLabel(18).ForeColor = &HC000&
       
     End If
   If Not CurSendSucc Then
      FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
      InstallationTrip = False
      Exit Function
   End If
   cTime = Timer
   Do Until Timer - cTime > 2
        DoEvents
   Loop

     If Not NowMoveFx = "D" Then
       FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Error in move direction,exit test."
       InstallationTrip = False
        'set JRH to 0
        CurSendSucc = False
          If bolWritePlcB_05(iDeviceID, JRHAddr, &H0) Then
            CurSendSucc = True
            FrmFuncTest.ButtonImg(3).Picture = LoadPicture(App.Path & "\button\rightbutton.GIF")
            FrmFuncTest.TitleLabel(14).ForeColor = &HC0C0C0
            JRHTstSta = False
          End If
        ' set DRH-D to 0
         CurSendSucc = False
           If bolWritePlcB_05(iDeviceID, DRH_DAddr, &H0) Then
             CurSendSucc = True
             FrmFuncTest.ButtonImg(9).Picture = LoadPicture(App.Path & "\button\Ballblue.GIF")
             FrmFuncTest.TitleLabel(18).ForeColor = &HC0C0C0
           End If
       Exit Function
     End If
   ' set DRH-D to 0
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_DAddr, &H0) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(9).Picture = LoadPicture(App.Path & "\button\Ballblue.GIF")
       FrmFuncTest.TitleLabel(18).ForeColor = &HC0C0C0
     End If
     FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Move in correct direction." & Chr(10)
     
      FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now Press down the DRH-U!Then send it some seconds later." & Chr(10) + Chr(13)
   ' set DRH-U to 1
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_UAddr, &HFF) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(12).Picture = LoadPicture(App.Path & "\button\ballgreen-on.GIF")
       FrmFuncTest.TitleLabel(16).ForeColor = &HC000&
     End If

   If Not CurSendSucc Then
     FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
     InstallationTrip = False
     Exit Function
   End If
   cTime = Timer
   Do Until Timer - cTime > 2
        DoEvents
   Loop

     If Not NowMoveFx = "U" Then
       FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Error in move direction,exit test."
       InstallationTrip = False
        'set JRH to 0
        CurSendSucc = False
          If bolWritePlcB_05(iDeviceID, JRHAddr, &H0) Then
            CurSendSucc = True
            FrmFuncTest.ButtonImg(3).Picture = LoadPicture(App.Path & "\button\rightbutton.GIF")
            FrmFuncTest.TitleLabel(14).ForeColor = &HC0C0C0
            JRHTstSta = False
          End If
          ' set DRH-U to 0
           CurSendSucc = False
             If bolWritePlcB_05(iDeviceID, DRH_UAddr, &H0) Then
               CurSendSucc = True
               FrmFuncTest.ButtonImg(12).Picture = LoadPicture(App.Path & "\button\Ballgreen.GIF")
               FrmFuncTest.TitleLabel(16).ForeColor = &HC0C0C0
        
             End If
   Exit Function
     End If
   ' set DRH-U to 0
   CurSendSucc = False
   cTime = Timer
   Do Until Timer - cTime > 2
     If bolWritePlcB_05(iDeviceID, DRH_UAddr, &H0) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(12).Picture = LoadPicture(App.Path & "\button\Ballgreen.GIF")
       FrmFuncTest.TitleLabel(16).ForeColor = &HC0C0C0

       
     End If
   Loop
   If Not CurSendSucc Then
      FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
      InstallationTrip = False
      Exit Function
   End If
FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Move in correct direction." & Chr(10)
   FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Now Press down DRH-D! Then send it some seconds later." & Chr(10) + Chr(13)
   ' set DRH-D to 1
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_DAddr, &HFF) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(9).Picture = LoadPicture(App.Path & "\button\ballblue-on.GIF")
       FrmFuncTest.TitleLabel(18).ForeColor = &HC000&

     End If
   If Not CurSendSucc Then
      FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
      InstallationTrip = False
      Exit Function
   End If

 
   'Waiting for one second
   cTime = Timer
   Do Until Timer - cTime > 2
        DoEvents
   Loop

     If Not NowMoveFx = "D" Then
       FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Error in move direction,exit test."
       InstallationTrip = False
               'set JRH to 0
        CurSendSucc = False
          If bolWritePlcB_05(iDeviceID, JRHAddr, &H0) Then
            CurSendSucc = True
            FrmFuncTest.ButtonImg(3).Picture = LoadPicture(App.Path & "\button\rightbutton.GIF")
            FrmFuncTest.TitleLabel(14).ForeColor = &HC0C0C0
            
            JRHTstSta = False
          End If
        
        If Not CurSendSucc Then
           FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
           InstallationTrip = False
           Exit Function
        End If
        ' set DRH-D to 0
        CurSendSucc = False
          If bolWritePlcB_05(iDeviceID, DRH_DAddr, &H0) Then
            CurSendSucc = True
            FrmFuncTest.ButtonImg(9).Picture = LoadPicture(App.Path & "\button\Ballblue.GIF")
            FrmFuncTest.TitleLabel(18).ForeColor = &HC0C0C0
          End If
   Exit Function
     End If
   ' set DRH-D to 0
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, DRH_DAddr, &H0) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(9).Picture = LoadPicture(App.Path & "\button\Ballblue.GIF")
       FrmFuncTest.TitleLabel(18).ForeColor = &HC0C0C0
     End If
   If Not CurSendSucc Then
      FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
      InstallationTrip = False
      Exit Function
   End If
   FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Move in correct direction." & Chr(10)
   'set JRH to 0
   CurSendSucc = False
     If bolWritePlcB_05(iDeviceID, JRHAddr, &H0) Then
       CurSendSucc = True
       FrmFuncTest.ButtonImg(3).Picture = LoadPicture(App.Path & "\button\rightbutton.GIF")
       FrmFuncTest.TitleLabel(14).ForeColor = &HC0C0C0
       
       JRHTstSta = False
     End If
   If Not CurSendSucc Then
      FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Handshake failed! Exit test!"
      InstallationTrip = False
      Exit Function
   End If
  FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "If all are right, click Yes commandbutton,Or click No commandbutton."
  Do Until YesCmdClick
    DoEvents
  Loop
  If FuncTestPass Then
    FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "Installation Trip Complished!" & Chr(10)
    InstallationTrip = True
  Else
    FrmFuncTest.TestText.Text = FrmFuncTest.TestText.Text + "  Installation Trip failed" & Chr(10)
    InstallationTrip = False
  End If
End Function

Public Function JABTest() As Boolean

 Dim cTime
 Dim CurSendSucc As Boolean

  'ButtonImg(1).Visible = False
  'TitleLabel(13).Visible = False
  'ButtonImg(2).Visible = False
  'TitleLabel(12).Visible = False
  'ButtonImg(3).Visible = False
  'TitleLabel(14).Visible = False
  'ButtonImg(4).Visible = False
  'T

⌨️ 快捷键说明

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