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

📄 frmmain.frm

📁 850运动控制卡的详细开发资料
💻 FRM
📖 第 1 页 / 共 3 页
字号:
         EndProperty
         Height          =   2055
         Left            =   120
         TabIndex        =   4
         Top             =   600
         Width           =   3495
         Begin VB.CheckBox chkSymmetryAcc_w 
            Caption         =   "W轴非对称加减速(默认对称)"
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   120
            TabIndex        =   31
            Top             =   1680
            Width           =   2895
         End
         Begin VB.CheckBox chkSymmetryAcc_z 
            Caption         =   "Z轴非对称加减速(默认对称)"
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   120
            TabIndex        =   30
            Top             =   1320
            Width           =   2775
         End
         Begin VB.CheckBox chkSymmetryAcc_y 
            Caption         =   "Y轴非对称加减速(默认对称)"
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   120
            TabIndex        =   29
            Top             =   960
            Width           =   2775
         End
         Begin VB.CheckBox chkSymmetryAcc_x 
            Caption         =   "X轴非对称加减速(默认对称)"
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   120
            TabIndex        =   28
            Top             =   600
            Width           =   2775
         End
         Begin VB.CheckBox chkCurve_S 
            Caption         =   "S曲线加减速(默认为直线)"
            Enabled         =   0   'False
            BeginProperty Font 
               Name            =   "MS Sans Serif"
               Size            =   9.75
               Charset         =   0
               Weight          =   400
               Underline       =   0   'False
               Italic          =   0   'False
               Strikethrough   =   0   'False
            EndProperty
            Height          =   255
            Left            =   120
            TabIndex        =   27
            Top             =   240
            Width           =   2655
         End
      End
   End
   Begin VB.Frame Frame1 
      Caption         =   "逻辑位置"
      BeginProperty Font 
         Name            =   "MS Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2775
      Left            =   120
      TabIndex        =   0
      Top             =   600
      Width           =   3735
      Begin VB.TextBox txtLogicPos_w 
         BackColor       =   &H8000000B&
         Height          =   375
         Left            =   1800
         Locked          =   -1  'True
         TabIndex        =   22
         Text            =   "0"
         Top             =   2040
         Width           =   1695
      End
      Begin VB.TextBox txtLogicPos_z 
         BackColor       =   &H8000000B&
         Height          =   375
         Left            =   1800
         Locked          =   -1  'True
         TabIndex        =   21
         Text            =   "0"
         Top             =   1442
         Width           =   1695
      End
      Begin VB.TextBox txtLogicPos_y 
         BackColor       =   &H8000000B&
         Height          =   375
         Left            =   1800
         Locked          =   -1  'True
         TabIndex        =   20
         Text            =   "0"
         Top             =   846
         Width           =   1695
      End
      Begin VB.TextBox txtLogicPos_x 
         BackColor       =   &H8000000B&
         Height          =   375
         Left            =   1800
         Locked          =   -1  'True
         TabIndex        =   19
         Text            =   "0"
         Top             =   250
         Width           =   1695
      End
      Begin VB.Label Label5 
         Caption         =   "W轴的逻辑位置:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   2160
         Width           =   1575
      End
      Begin VB.Label Label4 
         Caption         =   "Z轴的逻辑位置:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   13
         Top             =   1560
         Width           =   1575
      End
      Begin VB.Label Label3 
         Caption         =   "Y轴的逻辑位置:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   12
         Top             =   960
         Width           =   1575
      End
      Begin VB.Label Label2 
         Caption         =   "X轴的逻辑位置:"
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   9.75
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   255
         Left            =   120
         TabIndex        =   11
         Top             =   360
         Width           =   1575
      End
   End
   Begin VB.Label Label1 
      Alignment       =   2  'Center
      Caption         =   "850卡运动演示"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2520
      TabIndex        =   10
      Top             =   120
      Width           =   2655
   End
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim m_nLogicPos_w As Long
Dim m_nLogicPos_x As Long
Dim m_nLogicPos_y As Long
Dim m_nLogicPos_z As Long
Dim m_nCurrentSpeed_w As Long
Dim m_nCurrentSpeed_x As Long
Dim m_nCurrentSpeed_y As Long
Dim m_nCurrentSpeed_z As Long
Dim m_nCountPulse_w   As Long
Dim m_nCountPulse_x   As Long
Dim m_nCountPulse_y   As Long
Dim m_nCountPulse_z   As Long
Dim m_bEnableDemo_w   As Boolean
Dim m_bEnableDemo_x   As Boolean
Dim m_bEnableDemo_y   As Boolean
Dim m_bEnableDemo_z   As Boolean
Dim m_bEnableSymmetry_Acc_w As Boolean
Dim m_bEnableSymmetry_Acc_x As Boolean
Dim m_bEnableSymmetry_Acc_y As Boolean
Dim m_bEnableSymmetry_Acc_z As Boolean
Dim cardno As Long



Private Sub btnClear_Click()
'位置清零


     set_command_pos cardno, 1, 0
     set_command_pos cardno, 2, 0
     set_command_pos cardno, 3, 0
     set_command_pos cardno, 4, 0

End Sub

Private Sub btnContinueMove_Click()
Dim i As Integer
If Not m_bEnableDemo_x And Not m_bEnableDemo_y And Not m_bEnableDemo_z And Not m_bEnableDemo_w Then
   MsgBox "请选择驱动轴!"
   Exit Sub
   End If
   

    
  
    
    If Timer1.Enabled = False Then Timer1.Enabled = True
    
               set_range cardno, 1, 8000000 / m_nRatio_x
               set_range cardno, 2, 8000000 / m_nRatio_y
               set_range cardno, 3, 8000000 / m_nRatio_z
               set_range cardno, 4, 8000000 / m_nRatio_w


    
     If m_bEqualityVelocity Then
               set_startv cardno, 1, m_nDriveSpeed_x / m_nRatio_x
               set_startv cardno, 2, m_nDriveSpeed_y / m_nRatio_y
               set_startv cardno, 3, m_nDriveSpeed_z / m_nRatio_z
               set_startv cardno, 4, m_nDriveSpeed_w / m_nRatio_w
               
               set_speed cardno, 1, m_nDriveSpeed_x / m_nRatio_x
               set_speed cardno, 2, m_nDriveSpeed_y / m_nRatio_y
               set_speed cardno, 3, m_nDriveSpeed_z / m_nRatio_z
               set_speed cardno, 4, m_nDriveSpeed_w / m_nRatio_w
        Else
               set_startv cardno, 1, m_nStartV_x / m_nRatio_x
               set_startv cardno, 2, m_nStartV_y / m_nRatio_y
               set_startv cardno, 3, m_nStartV_z / m_nRatio_z
               set_startv cardno, 4, m_nStartV_w / m_nRatio_w
               
               set_speed cardno, 1, m_nDriveSpeed_x / m_nRatio_x
               set_speed cardno, 2, m_nDriveSpeed_y / m_nRatio_y
               set_speed cardno, 3, m_nDriveSpeed_z / m_nRatio_z
               set_speed cardno, 4, m_nDriveSpeed_w / m_nRatio_w
         End If
        If m_bEnableDemo_x Then continue_move cardno, 1, 0
        If m_bEnableDemo_y Then continue_move cardno, 2, 0
        If m_bEnableDemo_z Then continue_move cardno, 3, 0
        If m_bEnableDemo_w Then continue_move cardno, 4, 0
    
    
End Sub

Private Sub btnDetailSetting_Click()
    frmSetting.Show vbModal, frmMain
    btnPMove.Enabled = True
    btnContinueMove.Enabled = True
End Sub

Private Sub btnExit_Click()


      sudden_stop cardno, 1
      sudden_stop cardno, 2
      sudden_stop cardno, 3
      sudden_stop cardno, 4

    End

End Sub

Private Sub btnPMove_Click()
Dim i As Integer

If Not m_bEnableDemo_x And Not m_bEnableDemo_y And Not m_bEnableDemo_z And Not m_bEnableDemo_w Then
   MsgBox "请选择驱动轴!"
   Exit Sub
   End If
   

    
    If Timer1.Enabled = False Then Timer1.Enabled = True
    
               set_range cardno, 1, 8000000 / m_nRatio_x
               set_range cardno, 2, 8000000 / m_nRatio_y
               set_range cardno, 3, 8000000 / m_nRatio_z
               set_range cardno, 4, 8000000 / m_nRatio_w

 
        If m_bEqualityVelocity Then
               set_startv cardno, 1, m_nDriveSpeed_x / m_nRatio_x
               set_startv cardno, 2, m_nDriveSpeed_y / m_nRatio_y
               set_startv cardno, 3, m_nDriveSpeed_z / m_nRatio_z
               set_startv cardno, 4, m_nDriveSpeed_w / m_nRatio_w
               
               set_speed cardno, 1, m_nDriveSpeed_x / m_nRatio_x
               set_speed cardno, 2, m_nDriveSpeed_y / m_nRatio_y
               set_speed cardno, 3, m_nDriveSpeed_z / m_nRatio_z
               set_speed cardno, 4, m_nDriveSpeed_w / m_nRatio_w
        Else
               set_startv cardno, 1, m_nStartV_x / m_nRatio_x
               set_startv cardno, 2, m_nStartV_y / m_nRatio_y
               set_startv cardno, 3, m_nStartV_z / m_nRatio_z
               set_startv cardno, 4, m_nStartV_w / m_nRatio_w
               
               set_speed cardno, 1, m_nDriveSpeed_x / m_nRatio_x
               set_speed cardno, 2, m_nDriveSpeed_y / m_nRatio_y
               set_speed cardno, 3, m_nDriveSpeed_z / m_nRatio_z
               set_speed cardno, 4, m_nDriveSpeed_w / m_nRatio_w
         End If
         m_nCountPulse_x = CLng(txtPulseCount_x.Text)
         m_nCountPulse_y = CLng(txtPulseCount_y.Text)
         m_nCountPulse_z = CLng(txtPulseCount_z.Text)
         m_nCountPulse_w = CLng(txtPulseCount_w.Text)

        If m_bEnableDemo_x Then pmove 0, 1, m_nCountPulse_x
        If m_bEnableDemo_y Then pmove 0, 2, m_nCountPulse_y
        If m_bEnableDemo_z Then pmove 0, 3, m_nCountPulse_z
        If m_bEnableDemo_w Then pmove 0, 4, m_nCountPulse_w

    
End Sub

Private Sub btnStop_Click()

      sudden_stop cardno, 1
      sudden_stop cardno, 2
      sudden_stop cardno, 3
      sudden_stop cardno, 4

  
End Sub

Private Sub chkCurve_S_Click()
 If chkCurve_S.value = vbChecked Then
    m_bEnableCurve_S_Move = True
 Else
    m_bEnableCurve_S_Move = False
 End If
 
End Sub

Private Sub chkDemo_w_Click()
 Dim i As Integer
    If chkDemo_w.value = vbChecked Then
        m_bEnableDemo_w = True
        txtPulseCount_w.BackColor = &H80000005
        txtPulseCount_w.SetFocus
     
    Else
        m_bEnableDemo_w = False
        txtPulseCount_w.BackColor = &H8000000B
      
            sudden_stop cardno, 4
        
    End If
     txtPulseCount_w.Locked = Not m_bEnableDemo_w
End Sub

Private Sub chkDemo_x_Click()
 Dim i As Integer
     If chkDemo_x.value = vbChecked Then
        m_bEnableDemo_x = True
        txtPulseCount_x.BackColor = &H80000005
        txtPulseCount_x.SetFocus
   
    Else
        m_bEnableDemo_x = False
        txtPulseCount_x.BackColor = &H8000000B
               sudden_stop cardno, 1
   
    End If
     txtPulseCount_x.Locked = Not m_bEnableDemo_x
End Sub

Private Sub chkDemo_y_Click()
     Dim i As Integer
     If chkDemo_y.value = vbChecked Then
        m_bEnableDemo_y = True
        txtPulseCount_y.BackColor = &H80000005
        txtPulseCount_y.SetFocus
     
        
    Else
        m_bEnableDemo_y = False
        txtPulseCount_y.BackColor = &H8000000B
        
            sudden_stop cardno, 2
        
    End If
     txtPulseCount_y.Locked = Not m_bEnableDemo_y
End Sub

⌨️ 快捷键说明

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