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

📄 test.frm

📁 850运动控制卡的详细开发资料
💻 FRM
📖 第 1 页 / 共 3 页
字号:
      Caption         =   "回原点"
      Height          =   435
      Left            =   90
      TabIndex        =   2
      Top             =   3990
      Width           =   1125
   End
   Begin VB.CommandButton CmdInp 
      Caption         =   "插补"
      Height          =   435
      Left            =   2880
      TabIndex        =   1
      Top             =   3990
      Width           =   1125
   End
   Begin VB.CommandButton CmdPmove 
      Caption         =   "联动"
      Height          =   435
      Left            =   1485
      TabIndex        =   0
      Top             =   3990
      Width           =   1125
   End
End
Attribute VB_Name = "FrmTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim result As Long
Dim g_WorkStatus As Integer
Dim ifHand As Boolean





Private Sub CmdArc_Click()
    
    If g_WorkStatus = 1 Then Exit Sub
    
    Dim result As Integer
    
    Dim xY(6) As Single
    
    xY(0) = 5

    xY(1) = 5

    xY(2) = 15

    xY(3) = 15

    xY(4) = 5

    xY(5) = 5
        
    g_WorkStatus = 1
    
    If ChkX.value = 1 And ChkY.value = 1 And ChkZ.value <> 1 And ChkW.value <> 1 Then
    
        result = work_arc(1, 2, xY(0), 0, AddressOf MyProc)
    
        
    ElseIf ChkZ.value = 1 And ChkW.value = 1 And ChkX.value <> 1 And ChkY.value <> 1 Then
    
        result = work_arc(3, 4, xY(0), 0, AddressOf MyProc)
        
    Else
         
       MsgBox "选取的插补轴不能进行圆弧插补!"
         
       g_WorkStatus = 0
        
       Exit Sub
        
    End If
            
    If result = -1 Then
    
        MsgBox "有禁止轴参与运动,运动终止!"
        
    ElseIf result = -2 Then
    
        MsgBox "软限位报警,运动终止!"
        
    ElseIf result = -3 Then
    
        MsgBox "限位报警停止!"
        
    ElseIf result = -4 Then
    
        MsgBox "三点不能构成圆弧!"
        
    ElseIf result = -5 Then
    
        MsgBox "选取的插补轴不能进行圆弧插补!"
        
    ElseIf result = 0 Then
    
       MsgBox "人为终止!"
       
    ElseIf result = 1 Then
    
        MsgBox "驱动成功!"
        
    End If
    
    g_WorkStatus = 0
    
End Sub

Private Sub CmdContinue_Click()
     
     If g_WorkStatus = 1 Then Exit Sub
     
     g_WorkStatus = 1

    If ChkX.value = 1 And ChkY.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
        result = continue_move4(0, 1, 0, 1, 0, AddressOf MyProc)
               
    ElseIf ChkX.value = 1 And ChkY.value = 1 And ChkZ.value = 1 Then
    
        result = continue_move3(1, 0, 2, 0, 3, 0, 0, AddressOf MyProc)
        
    ElseIf ChkX.value = 1 And ChkY.value = 1 And ChkW.value = 1 Then
        
        result = continue_move3(1, 0, 2, 0, 4, 0, 0, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
        result = continue_move3(1, 0, 3, 0, 4, 0, 0, AddressOf MyProc)
       
    ElseIf ChkY.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
        result = continue_move3(2, 0, 3, 0, 4, 0, 0, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 Then
    
        result = continue_move2(1, 0, 2, 0, 0, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkZ.value = 1 Then
    
        result = continue_move2(1, 0, 3, 0, 0, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkW.value = 1 Then
    
        result = continue_move2(1, 0, 4, 0, 0, AddressOf MyProc)
       
    ElseIf ChkY.value = 1 And ChkZ.value = 1 Then
    
        result = continue_move2(2, 0, 3, 0, 0, AddressOf MyProc)
       
    ElseIf ChkY.value = 1 And ChkW.value = 1 Then
    
        result = continue_move2(2, 0, 4, 0, 0, AddressOf MyProc)
       
    ElseIf ChkZ.value = 1 And ChkW.value = 1 Then
    
        result = continue_move2(3, 0, 4, 0, 0, AddressOf MyProc)
    
    ElseIf ChkX.value = 1 Then
    
        result = continue_move1(1, 0, 0, AddressOf MyProc)
        
    ElseIf ChkY.value = 1 Then
    
        result = continue_move1(2, 0, 0, AddressOf MyProc)
        
    ElseIf ChkZ.value = 1 Then
    
        result = continue_move1(3, 0, 0, AddressOf MyProc)
        
    ElseIf ChkW.value = 1 Then
    
        result = continue_move1(4, 0, 0, AddressOf MyProc)
        
    Else
    
        Exit Sub
       
    End If
    
    If result = -1 Then
    
        MsgBox "有禁止轴参与运动,运动终止!"
        
    ElseIf result = -3 Then
    
        MsgBox "限位报警停止!"
        
    ElseIf result = 0 Then
    
       MsgBox "人为终止!"
    
    ElseIf result = 1 Then
    
       MsgBox "驱动成功!"
        
    End If
    
    g_WorkStatus = 0

End Sub

Private Sub CmdFree_Click()

    If g_WorkStatus = 1 Then Exit Sub
    
    g_WorkStatus = 1
    
   If ChkX.value = 1 And ChkY.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
      If Mode.value = 1 Then
       
        result = free_move4(pos(0).Text, 5, 8, 0.2, pos(1).Text, 3, 5, 0.1, pos(2).Text, 6, 7, 0.1, pos(3).Text, 4, 5, 0.1, 0, AddressOf MyProc)
        
      Else
      
        result = free_move4(pos(0).Text, 5, 8, 0.2, pos(1).Text, 3, 5, 0.1, pos(2).Text, 6, 7, 0.1, pos(3).Text, 4, 5, 0.1, 1, AddressOf MyProc)
        
      End If
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 And ChkZ.value = 1 Then
    
      If Mode.value = 1 Then
       
        result = free_move3(1, pos(0).Text, 5, 8, 0.2, 2, pos(1).Text, 3, 5, 0.1, 3, pos(2).Text, 6, 7, 0.1, 0, AddressOf MyProc)
        
      Else
      
        result = free_move3(1, pos(0).Text, 5, 8, 0.2, 2, pos(1).Text, 3, 5, 0.1, 3, pos(2).Text, 6, 7, 0.1, 1, AddressOf MyProc)
        
      End If
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 And ChkW.value = 1 Then
    
       If Mode.value = 1 Then
       
        result = free_move3(1, pos(0).Text, 5, 8, 0.2, 2, pos(1).Text, 3, 5, 0.1, 4, pos(3).Text, 6, 7, 0.1, 0, AddressOf MyProc)
        
      Else
      
        result = free_move3(1, pos(0).Text, 5, 8, 0.2, 2, pos(1).Text, 3, 5, 0.1, 4, pos(3).Text, 6, 7, 0.1, 1, AddressOf MyProc)
        
      End If
       
    ElseIf ChkX.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
       If Mode.value = 1 Then
       
        result = free_move3(1, pos(0).Text, 5, 8, 0.2, 3, pos(2).Text, 3, 5, 0.1, 4, pos(3).Text, 6, 7, 0.1, 0, AddressOf MyProc)
        
      Else
      
        result = free_move3(1, pos(0).Text, 5, 8, 0.2, 3, pos(2).Text, 3, 5, 0.1, 4, pos(3).Text, 6, 7, 0.1, 1, AddressOf MyProc)
        
      End If
       
    ElseIf ChkY.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
       If Mode.value = 1 Then
       
        result = free_move3(2, pos(1).Text, 5, 8, 0.2, 3, pos(2).Text, 3, 5, 0.1, 4, pos(3).Text, 6, 7, 0.1, 0, AddressOf MyProc)
        
      Else
      
        result = free_move3(2, pos(1).Text, 5, 8, 0.2, 3, pos(2).Text, 3, 5, 0.1, 4, pos(3).Text, 6, 7, 0.1, 1, AddressOf MyProc)
        
      End If
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 Then
    
       If Mode.value = 1 Then
       
         result = free_move2(1, pos(0).Text, 4, 5, 0.1, 2, pos(1).Text, 5, 6, 0.2, 0, AddressOf MyProc)
         
       Else
       
         result = free_move2(1, pos(0).Text, 4, 5, 0.1, 2, pos(1).Text, 5, 6, 0.2, 1, AddressOf MyProc)
       
       End If
       
    ElseIf ChkX.value = 1 And ChkZ.value = 1 Then
    
       If Mode.value = 1 Then
       
         result = free_move2(1, pos(0).Text, 4, 5, 0.1, 3, pos(2).Text, 5, 6, 0.2, 0, AddressOf MyProc)
         
       Else
       
         result = free_move2(1, pos(0).Text, 4, 5, 0.1, 3, pos(2).Text, 5, 6, 0.2, 1, AddressOf MyProc)
       
       End If
       
    ElseIf ChkX.value = 1 And ChkW.value = 1 Then
    
       If Mode.value = 1 Then
       
         result = free_move2(1, pos(0).Text, 4, 5, 0.1, 4, pos(3).Text, 5, 6, 0.2, 0, AddressOf MyProc)
         
       Else
       
         result = free_move2(1, pos(0).Text, 4, 5, 0.1, 4, pos(3).Text, 5, 6, 0.2, 1, AddressOf MyProc)
       
       End If
       
    ElseIf ChkY.value = 1 And ChkZ.value = 1 Then
    
       If Mode.value = 1 Then
       
         result = free_move2(2, pos(1).Text, 4, 5, 0.1, 3, pos(2).Text, 5, 6, 0.2, 0, AddressOf MyProc)
         
       Else
       
         result = free_move2(2, pos(1).Text, 4, 5, 0.1, 3, pos(2).Text, 5, 6, 0.2, 1, AddressOf MyProc)
       
       End If
       
    ElseIf ChkY.value = 1 And ChkW.value = 1 Then
    
       If Mode.value = 1 Then
       
         result = free_move2(2, pos(1).Text, 4, 5, 0.1, 4, pos(3).Text, 5, 6, 0.2, 0, AddressOf MyProc)
         
       Else
       
         result = free_move2(2, pos(1).Text, 4, 5, 0.1, 4, pos(3).Text, 5, 6, 0.2, 1, AddressOf MyProc)
       
       End If
       
    ElseIf ChkZ.value = 1 And ChkW.value = 1 Then
    
       If Mode.value = 1 Then
       
         result = free_move2(3, pos(2).Text, 4, 5, 0.1, 4, pos(3).Text, 5, 6, 0.2, 0, AddressOf MyProc)
         
       Else
       
         result = free_move2(3, pos(2).Text, 4, 5, 0.1, 4, pos(3).Text, 5, 6, 0.2, 1, AddressOf MyProc)
       
       End If
       
    ElseIf ChkX.value = 1 Then
    
        If Mode.value = 1 Then
       
         result = free_move1(1, pos(0).Text, 4, 5, 0.1, 0, AddressOf MyProc)
         
       Else
       
         result = free_move1(1, pos(0).Text, 4, 5, 0.1, 1, AddressOf MyProc)
       
       End If
        
    ElseIf ChkY.value = 1 Then
    
        If Mode.value = 1 Then
       
         result = free_move1(2, pos(1).Text, 4, 5, 0.1, 0, AddressOf MyProc)
         
       Else
       
         result = free_move1(2, pos(1).Text, 4, 5, 0.1, 1, AddressOf MyProc)
       
       End If
        
    ElseIf ChkZ.value = 1 Then
    
        If Mode.value = 1 Then
       
         result = free_move1(3, pos(2).Text, 4, 5, 0.1, 0, AddressOf MyProc)
         
       Else
       
         result = free_move1(3, pos(2).Text, 4, 5, 0.1, 1, AddressOf MyProc)
       
       End If
        
    ElseIf ChkW.value = 1 Then
    
        If Mode.value = 1 Then
       
         result = free_move1(4, pos(3).Text, 4, 5, 0.1, 0, AddressOf MyProc)
         
       Else
       
         result = free_move1(4, pos(3).Text, 4, 5, 0.1, 1, AddressOf MyProc)
       
       End If
       
    Else
    
      Exit Sub
      
    End If
    
    If result = -1 Then
    
        MsgBox "有禁止轴参与运动,运动终止!"
        
    ElseIf result = -2 Then
    
        MsgBox "软限位报警,运动终止!"
        
    ElseIf result = -3 Then
    
        MsgBox "限位报警停止!"
        
    ElseIf result = 0 Then
    
       MsgBox "人为终止!"
       
    ElseIf result = 1 Then
    
        MsgBox "驱动成功!"
        
    End If
    
    g_WorkStatus = 0

End Sub

Private Sub CmdHome_Click()

    If g_WorkStatus = 1 Then Exit Sub
    
    g_WorkStatus = 1

    If ChkX.value = 1 And ChkY.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
      result = home4(AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 And ChkZ.value = 1 Then
    
      result = home3(1, 2, 3, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 And ChkW.value = 1 Then
    
       result = home3(1, 2, 4, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
       result = home3(1, 3, 4, AddressOf MyProc)
       
    ElseIf ChkY.value = 1 And ChkZ.value = 1 And ChkW.value = 1 Then
    
       result = home3(2, 3, 4, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkY.value = 1 Then
    
       result = home2(1, 2, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkZ.value = 1 Then
    
       result = home2(1, 3, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 And ChkW.value = 1 Then
    
       result = home2(1, 4, AddressOf MyProc)
       
    ElseIf ChkY.value = 1 And ChkZ.value = 1 Then
    
       result = home2(2, 3, AddressOf MyProc)
       
    ElseIf ChkY.value = 1 And ChkW.value = 1 Then
    
       result = home2(2, 4, AddressOf MyProc)
       
    ElseIf ChkZ.value = 1 And ChkW.value = 1 Then
    
       result = home2(3, 4, AddressOf MyProc)
       
    ElseIf ChkX.value = 1 Then
    
        result = home1(1, AddressOf MyProc)
        
    ElseIf ChkY.value = 1 Then
    
        result = home1(2, AddressOf MyProc)
        
    ElseIf ChkZ.value = 1 Then
    
        result = home1(3, AddressOf MyProc)
        
    ElseIf ChkW.value = 1 Then
    
        result = home1(4, AddressOf MyProc)
        
    Else
    
        Exit Sub
        
    End If
    

    If result = -1 Then
    
        MsgBox "有禁止轴参与运动,回原点终止!"
        
    ElseIf result = -2 Then
    
        MsgBox "未找到原点信号,回原点失败!"
        
    ElseIf result = 0 Then
    
       MsgBox "回原点人为终止!"
       
    ElseIf result = 1 Then
    
        MsgBox "回原点成功!"
        
    End If
   
   g_WorkStatus = 0
   
End Sub

Private Sub CmdInit_Click()

    result = adt850_init_board
    
    If result <= 0 Then
    
        MsgBox "控制卡检测错误!"
        

⌨️ 快捷键说明

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