Blame | Last modification | View Log | RSS feed
VERSION 5.00
Begin VB.Form DLGForm
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "VB Test USMCDLL"
ClientHeight = 4455
ClientLeft = 5325
ClientTop = 4665
ClientWidth = 5910
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4455
ScaleWidth = 5910
Visible = 0 'False
Begin VB.Frame Frame3
Height = 1215
HelpContextID = 8
Left = 3240
TabIndex = 18
Top = 1800
Width = 2535
Begin VB.CheckBox ChPower
Caption = "Power"
Height = 375
Index = 1
Left = 120
Style = 1 'Graphical
TabIndex = 20
Top = 240
Value = 1 'Checked
Width = 735
End
Begin VB.CommandButton Command1
Caption = "USMC_SetMode"
Height = 855
Left = 960
TabIndex = 19
Top = 240
Width = 1455
End
End
Begin VB.Frame Frame2
Caption = "USMC_Start"
Height = 1095
Left = 120
TabIndex = 9
Top = 3240
Width = 5055
Begin VB.TextBox TSP
Alignment = 1 'Right Justify
Height = 285
Left = 840
TabIndex = 15
Text = "3000"
Top = 600
Width = 1095
End
Begin VB.TextBox TDP
Alignment = 1 'Right Justify
Height = 285
Left = 840
TabIndex = 14
Text = "0"
Top = 240
Width = 1095
End
Begin VB.CommandButton CStart
Caption = "USMC_Start"
Height = 735
Left = 3360
TabIndex = 12
Top = 240
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 315
ItemData = "DLGForm.frx":0000
Left = 2160
List = "DLGForm.frx":0002
Style = 2 'Dropdown List
TabIndex = 10
Top = 600
Width = 1095
End
Begin VB.Label Label3
Alignment = 1 'Right Justify
Caption = "Speed"
Height = 255
Left = 120
TabIndex = 17
Top = 630
Width = 615
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Caption = "DestPos"
Height = 255
Left = 120
TabIndex = 16
Top = 270
Width = 615
End
Begin VB.Label Label1
Alignment = 2 'Center
Caption = "Step Divisor"
Height = 255
Left = 2160
TabIndex = 11
Top = 240
Width = 1095
End
End
Begin VB.Frame Frame1
Caption = "USMC_Mode"
Height = 1215
HelpContextID = 8
Left = 120
TabIndex = 0
Top = 1800
Width = 3015
Begin VB.CommandButton CSetMode
Caption = "USMC_SetMode"
Height = 855
Left = 1320
TabIndex = 13
Top = 240
Width = 1575
End
Begin VB.CheckBox ChTrSwap
Caption = "TrSwap"
Height = 375
Index = 0
Left = 120
Style = 1 'Graphical
TabIndex = 8
Top = 720
Value = 1 'Checked
Width = 1095
End
Begin VB.CheckBox ChPower
Caption = "Power"
Height = 375
Index = 0
Left = 120
Style = 1 'Graphical
TabIndex = 7
Top = 240
Value = 1 'Checked
Width = 1095
End
End
Begin VB.CommandButton CSaveParametersToFlash
Caption = "USMC_SaveParametersToFlash"
Height = 495
Left = 3120
TabIndex = 6
Top = 1200
Width = 2655
End
Begin VB.CommandButton CSetParameters
Caption = "USMC_SetParameters"
Height = 495
Left = 240
TabIndex = 5
Top = 1200
Width = 2655
End
Begin VB.CommandButton CGetLastErr
Caption = "USMC_GetLastErr"
Height = 495
Left = 4073
TabIndex = 4
Top = 570
Width = 1695
End
Begin VB.CommandButton CStop
Caption = "USMC_Stop"
Height = 495
Left = 2153
TabIndex = 3
Top = 570
Width = 1695
End
Begin VB.CommandButton CGetState
Caption = "USMC_GetState"
Height = 495
Left = 233
TabIndex = 2
Top = 570
Width = 1695
End
Begin VB.Label TextSel
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
Height = 300
Left = 203
TabIndex = 1
Top = 120
Width = 5595
End
End
Attribute VB_Name = "DLGForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Err As Long
Private Sub CGetLastErr_Click()
PrintError
End Sub
Private Sub CGetState_Click()
Dim state As USMCState
Err = USMCGetState(Dev, state)
If Err <> 0 Then
PrintError
Else
PrintDState state
End If
End Sub
Private Sub Command1_Click()
Dim mode As USMCMode
Err = USMCGetMode(Dev, mode)
If Err <> 0 Then
PrintError
End If
If ChPower.Item(1).value = 1 Then
mode.ResetD = 0
Else
mode.ResetD = 1
End If
Err = USMCSetMode(Dev, mode)
If Err <> 0 Then
PrintError
Else
PrintDMode mode
End If
End Sub
Private Sub CSaveParametersToFlash_Click()
Err = USMCSaveParametersToFlash(Dev)
If Err <> 0 Then
PrintError
Else
MsgBox "Parameters Should be Saved", vbOKOnly, "USMC_SaveParametersToFlash Successful"
End If
End Sub
Private Sub CSetMode_Click()
Dim mode As USMCMode
Err = USMCGetMode(Dev, mode)
If Err <> 0 Then
PrintError
End If
'------------------------------------------------------------
' Set your mode parameters here '
If ChPower.Item(0).value = 1 Then
mode.ResetD = 0
Else
mode.ResetD = 1
End If
mode.Tr1En = 1: mode.Tr2En = 1
If ChTrSwap.Item(0).value = 1 Then
mode.TrSwap = 1
Else
mode.TrSwap = 0
End If
'------------------------------------------------------------
Err = USMCSetMode(Dev, mode)
If Err <> 0 Then
PrintError
Else
PrintDMode mode
End If
End Sub
Private Sub CSetParameters_Click()
Dim params As USMCParameters
Err = USMCGetParameters(Dev, params)
If Err <> 0 Then
PrintError
End If
'------------------------------------------------------------
' Set your parameters here '
params.BTimeout1 = 1000
' '
'------------------------------------------------------------
Err = USMCSetParameters(Dev, params)
If Err <> 0 Then
PrintError
Else
PrintDParameters params
End If
End Sub
Private Sub CStart_Click()
Dim sp As USMCStartParameters
Dim DestPos As Long
Dim Speed As Single
Err = USMCGetStartParameters(Dev, sp)
If Err <> 0 Then
PrintError
End If
'------------------------------------------------------------
' Set your start parameters here '
sp.SDivisor = Combo1.Text
DestPos = CLng(TDP.Text)
Speed = CSng(TSP.Text)
' '
'------------------------------------------------------------
Err = USMCStart(Dev, DestPos, Speed, sp)
If Err <> 0 Then
PrintError
Else
PrintDStartParameters DestPos, Speed, sp
End If
End Sub
Private Sub CStop_Click()
Err = USMCStop(Dev)
If Err <> 0 Then
PrintError
Else
MsgBox "Should be Stoped", vbOKOnly, "USMC_Stop Successful"
End If
End Sub
Private Sub Form_Load()
TextSel.Caption = "S/N: " & serial & " Version: " & version
Combo1.AddItem "1": Combo1.AddItem "2": Combo1.AddItem "4": Combo1.AddItem "8"
Combo1.ListIndex = 0
Show
End Sub