VERSION 5.00
Begin VB.Form frmMove 
   Caption         =   "Point - to Point moves"
   ClientHeight    =   4545
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7380
   LinkTopic       =   "Form1"
   ScaleHeight     =   4545
   ScaleWidth      =   7380
   StartUpPosition =   3  'Windows Default
   Begin VB.Timer Timer1 
      Interval        =   500
      Left            =   6360
      Top             =   1200
   End
   Begin VB.TextBox MoveParamsText 
      Height          =   285
      Index           =   5
      Left            =   2400
      TabIndex        =   15
      Text            =   "0"
      Top             =   2520
      Width           =   2415
   End
   Begin VB.TextBox MoveParamsText 
      Height          =   285
      Index           =   4
      Left            =   1680
      TabIndex        =   11
      Top             =   1920
      Width           =   1095
   End
   Begin VB.TextBox MoveParamsText 
      Height          =   285
      Index           =   3
      Left            =   1680
      TabIndex        =   10
      Top             =   1560
      Width           =   1095
   End
   Begin VB.TextBox MoveParamsText 
      Height          =   285
      Index           =   2
      Left            =   1680
      TabIndex        =   9
      Top             =   1200
      Width           =   1095
   End
   Begin VB.TextBox MoveParamsText 
      Height          =   285
      Index           =   1
      Left            =   1680
      TabIndex        =   8
      Top             =   840
      Width           =   1095
   End
   Begin VB.TextBox MoveParamsText 
      Height          =   285
      Index           =   0
      Left            =   1680
      TabIndex        =   7
      Top             =   480
      Width           =   1095
   End
   Begin VB.CommandButton AbortMoveBtn 
      Caption         =   "Abort Move"
      Height          =   375
      Left            =   2880
      TabIndex        =   2
      Top             =   3240
      Width           =   1455
   End
   Begin VB.CommandButton MoveExeBtn 
      Caption         =   "Execute Move"
      Height          =   375
      Left            =   360
      TabIndex        =   1
      Top             =   3240
      Width           =   1455
   End
   Begin VB.CommandButton ExitBtn 
      Caption         =   "Exit"
      Height          =   495
      Left            =   5280
      TabIndex        =   0
      Top             =   3720
      Width           =   1455
   End
   Begin VB.Label AposLbl 
      Caption         =   "------"
      Height          =   255
      Left            =   4800
      TabIndex        =   16
      Top             =   240
      Width           =   2295
   End
   Begin VB.Label Label7 
      Caption         =   "Actual Position"
      Height          =   255
      Left            =   3480
      TabIndex        =   14
      Top             =   240
      Width           =   1095
   End
   Begin VB.Label Tpos 
      Caption         =   "Move distance"
      Height          =   255
      Left            =   360
      TabIndex        =   13
      Top             =   2520
      Width           =   1695
   End
   Begin VB.Label Label5 
      Caption         =   "Max Velocity"
      Height          =   255
      Left            =   360
      TabIndex        =   12
      Top             =   2040
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "Units"
      Height          =   255
      Left            =   360
      TabIndex        =   6
      Top             =   480
      Width           =   615
   End
   Begin VB.Label Label3 
      Caption         =   "Quick Decel"
      Height          =   255
      Left            =   360
      TabIndex        =   5
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "Decel"
      Height          =   255
      Left            =   360
      TabIndex        =   4
      Top             =   1200
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "Accel"
      Height          =   255
      Left            =   360
      TabIndex        =   3
      Top             =   840
      Width           =   615
   End
End
Attribute VB_Name = "frmMove"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub ExitBtn_Click()
       res = SS940_SetParamAsInteger(SHANDLE, 52, 0)
       Unload frmMove
End Sub

Private Sub Form_Activate()
Dim pids(4) As Byte, par_values(4) As Double, res As Long, VarId As Long, Apos As Double

pids(0) = 186
pids(1) = 181
pids(2) = 182
pids(3) = 183
pids(4) = 180
VarId = 215      'Actual position variable number
    res = SS940_GetParamAsDouble(SHANDLE, ByVal VarId, Apos)
    If (res) Then AposLbl.Caption = Str(Apos)
    res = SS940_GetArrayAsDouble(SHANDLE, pids(0), par_values(0), 5)
    If res = EC_OK Then
        For I = 0 To UBound(pids)
                
                MoveParamsText(I).Text = Str(par_values(I))
        Next
    End If
End Sub

Private Sub MoveExeBtn_Click()

Dim pids(5) As Long, par_values(5) As Double, res As Long

'This function uses list function SS940_SetArrayAsDouble to set parameters in one IP packet as opposed to
'set them individualy thus saving a great deal of time.Up to 10 parameters can be transmitted simultanously

'Convert user input to parameters values and for the values array.

pids(0) = 186
pids(1) = 181
pids(2) = 182
pids(3) = 183
pids(4) = 180
pids(5) = 93            'must be last since writing value will attemt to execute move

    For I = 0 To UBound(pids)
        par_values(I) = Val(MoveParamsText(I))
    Next
        res = SS940_SetParamAsInteger(SHANDLE, 52, 1)
    If res = EC_OK Then
        res = SS940_SetArrayAsDouble(SHANDLE, pids(0), par_values(0), 6)
    Else
        MsgBox "Drive failed to enable", vbCritical + vbOKOnly, "Error"
    End If

End Sub


Private Sub MoveParams_Change(Index As Integer)

End Sub

Private Sub Timer1_Timer()
Dim par As Double, VarId As Long, res As Long
VarId = 215
If Connected Then
    res = SS940_GetParamAsDouble(SHANDLE2, VarId, par)
    If res = EC_OK Then
       AposLbl.Caption = Str(par)
    End If
End If

End Sub
