Subversion Repositories f9daq

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
284 f9daq 1
VERSION 5.00
2
Begin VB.Form DLGForm
3
   AutoRedraw      =   -1  'True
4
   BorderStyle     =   3  'Fixed Dialog
5
   Caption         =   "VB Test USMCDLL"
6
   ClientHeight    =   4455
7
   ClientLeft      =   5325
8
   ClientTop       =   4665
9
   ClientWidth     =   6000
10
   LinkTopic       =   "Form1"
11
   MaxButton       =   0   'False
12
   MinButton       =   0   'False
13
   ScaleHeight     =   4455
14
   ScaleWidth      =   6000
15
   Visible         =   0   'False
16
   Begin VB.Frame Frame2
17
      Caption         =   "USMC_Start"
18
      Height          =   1095
19
      Left            =   120
20
      TabIndex        =   9
21
      Top             =   3240
22
      Width           =   5055
23
      Begin VB.TextBox TSP
24
         Alignment       =   1  'Right Justify
25
         Height          =   285
26
         Left            =   840
27
         TabIndex        =   15
28
         Text            =   "3000"
29
         Top             =   600
30
         Width           =   1095
31
      End
32
      Begin VB.TextBox TDP
33
         Alignment       =   1  'Right Justify
34
         Height          =   285
35
         Left            =   840
36
         TabIndex        =   14
37
         Text            =   "0"
38
         Top             =   240
39
         Width           =   1095
40
      End
41
      Begin VB.CommandButton CStart
42
         Caption         =   "USMC_Start"
43
         Height          =   735
44
         Left            =   3360
45
         TabIndex        =   12
46
         Top             =   240
47
         Width           =   1575
48
      End
49
      Begin VB.ComboBox Combo1
50
         Height          =   315
51
         ItemData        =   "DLGForm.frx":0000
52
         Left            =   2160
53
         List            =   "DLGForm.frx":0002
54
         Style           =   2  'Dropdown List
55
         TabIndex        =   10
56
         Top             =   600
57
         Width           =   1095
58
      End
59
      Begin VB.Label Label3
60
         Alignment       =   1  'Right Justify
61
         Caption         =   "Speed"
62
         Height          =   255
63
         Left            =   120
64
         TabIndex        =   17
65
         Top             =   630
66
         Width           =   615
67
      End
68
      Begin VB.Label Label2
69
         Alignment       =   1  'Right Justify
70
         Caption         =   "DestPos"
71
         Height          =   255
72
         Left            =   120
73
         TabIndex        =   16
74
         Top             =   270
75
         Width           =   615
76
      End
77
      Begin VB.Label Label1
78
         Alignment       =   2  'Center
79
         Caption         =   "Step Divisor"
80
         Height          =   255
81
         Left            =   2160
82
         TabIndex        =   11
83
         Top             =   240
84
         Width           =   1095
85
      End
86
   End
87
   Begin VB.Frame Frame1
88
      Caption         =   "USMC_Mode"
89
      Height          =   1215
90
      HelpContextID   =   8
91
      Left            =   120
92
      TabIndex        =   0
93
      Top             =   1800
94
      Width           =   3375
95
      Begin VB.CommandButton CSetMode
96
         Caption         =   "USMC_SetMode"
97
         Height          =   855
98
         Left            =   1680
99
         TabIndex        =   13
100
         Top             =   240
101
         Width           =   1575
102
      End
103
      Begin VB.CheckBox ChTrSwap
104
         Caption         =   "TrSwap"
105
         Height          =   375
106
         Index           =   0
107
         Left            =   120
108
         Style           =   1  'Graphical
109
         TabIndex        =   8
110
         Top             =   720
111
         Value           =   1  'Checked
112
         Width           =   1335
113
      End
114
      Begin VB.CheckBox ChPower
115
         Caption         =   "Power"
116
         Height          =   375
117
         Index           =   0
118
         Left            =   120
119
         Style           =   1  'Graphical
120
         TabIndex        =   7
121
         Top             =   240
122
         Value           =   1  'Checked
123
         Width           =   1335
124
      End
125
   End
126
   Begin VB.CommandButton CSaveParametersToFlash
127
      Caption         =   "USMC_SaveParametersToFlash"
128
      Height          =   495
129
      Left            =   3120
130
      TabIndex        =   6
131
      Top             =   1200
132
      Width           =   2655
133
   End
134
   Begin VB.CommandButton CSetParameters
135
      Caption         =   "USMC_SetParameters"
136
      Height          =   495
137
      Left            =   240
138
      TabIndex        =   5
139
      Top             =   1200
140
      Width           =   2655
141
   End
142
   Begin VB.CommandButton CGetLastErr
143
      Caption         =   "USMC_GetLastErr"
144
      Height          =   495
145
      Left            =   4073
146
      TabIndex        =   4
147
      Top             =   570
148
      Width           =   1695
149
   End
150
   Begin VB.CommandButton CStop
151
      Caption         =   "USMC_Stop"
152
      Height          =   495
153
      Left            =   2153
154
      TabIndex        =   3
155
      Top             =   570
156
      Width           =   1695
157
   End
158
   Begin VB.CommandButton CGetState
159
      Caption         =   "USMC_GetState"
160
      Height          =   495
161
      Left            =   233
162
      TabIndex        =   2
163
      Top             =   570
164
      Width           =   1695
165
   End
166
   Begin VB.Label TextSel
167
      Alignment       =   2  'Center
168
      BorderStyle     =   1  'Fixed Single
169
      Height          =   300
170
      Left            =   203
171
      TabIndex        =   1
172
      Top             =   120
173
      Width           =   5595
174
   End
175
End
176
Attribute VB_Name = "DLGForm"
177
Attribute VB_GlobalNameSpace = False
178
Attribute VB_Creatable = False
179
Attribute VB_PredeclaredId = True
180
Attribute VB_Exposed = False
181
Dim Err As Long
182
 
183
Private Sub CGetLastErr_Click()
184
    PrintError
185
End Sub
186
 
187
Private Sub CGetState_Click()
188
    Dim state As USMCState
189
    Err = USMCGetState(Dev, state)
190
    If Err <> 0 Then
191
        PrintError
192
    Else
193
        PrintDState state
194
    End If
195
End Sub
196
Private Sub CSaveParametersToFlash_Click()
197
    Err = USMCSaveParametersToFlash(Dev)
198
    If Err <> 0 Then
199
        PrintError
200
    Else
201
        MsgBox "Parameters Should be Saved", vbOKOnly, "USMC_SaveParametersToFlash Successful"
202
    End If
203
End Sub
204
 
205
Private Sub CSetMode_Click()
206
    Dim mode As USMCMode
207
    Err = USMCGetMode(Dev, mode)
208
    If Err <> 0 Then
209
        PrintError
210
    End If
211
'------------------------------------------------------------
212
'   Set your mode parameters here                           '
213
    If ChPower.Item(0).value = 1 Then
214
        mode.ResetD = 0
215
    Else
216
        mode.ResetD = 1
217
    End If
218
    mode.Tr1En = 1: mode.Tr2En = 1
219
    If ChTrSwap.Item(0).value = 1 Then
220
        mode.TrSwap = 1
221
    Else
222
        mode.TrSwap = 0
223
    End If
224
 
225
'                                                           '
226
'------------------------------------------------------------
227
    Err = USMCSetMode(Dev, mode)
228
    If Err <> 0 Then
229
        PrintError
230
    Else
231
        PrintDMode mode
232
    End If
233
End Sub
234
 
235
Private Sub CSetParameters_Click()
236
    Dim params As USMCParameters
237
    Err = USMCGetParameters(Dev, params)
238
    If Err <> 0 Then
239
        PrintError
240
    End If
241
'------------------------------------------------------------
242
'   Set your parameters here                                '
243
    params.BTimeout1 = 1000
244
'                                                           '
245
'------------------------------------------------------------
246
    Err = USMCSetParameters(Dev, params)
247
    If Err <> 0 Then
248
        PrintError
249
    Else
250
        PrintDParameters params
251
    End If
252
 
253
End Sub
254
 
255
Private Sub CStart_Click()
256
    Dim sp As USMCStartParameters
257
    Dim DestPos As Long
258
    Dim Speed As Single
259
 
260
    Err = USMCGetStartParameters(Dev, sp)
261
    If Err <> 0 Then
262
        PrintError
263
    End If
264
'------------------------------------------------------------
265
'   Set your start parameters here                          '
266
    sp.SDivisor = Combo1.Text
267
    DestPos = CLng(TDP.Text)
268
    Speed = CSng(TSP.Text)
269
'                                                           '
270
'------------------------------------------------------------
271
    Err = USMCStart(Dev, DestPos, Speed, sp)
272
    If Err <> 0 Then
273
        PrintError
274
    Else
275
        PrintDStartParameters DestPos, Speed, sp
276
    End If
277
 
278
End Sub
279
 
280
Private Sub CStop_Click()
281
    Err = USMCStop(Dev)
282
    If Err <> 0 Then
283
        PrintError
284
    Else
285
        MsgBox "Should be Stoped", vbOKOnly, "USMC_Stop Successful"
286
    End If
287
 
288
End Sub
289
 
290
Private Sub Form_Load()
291
    TextSel.Caption = "S/N: " & serial & "  Version: " & version
292
    Combo1.AddItem "1": Combo1.AddItem "2": Combo1.AddItem "4": Combo1.AddItem "8"
293
    Combo1.ListIndex = 0
294
    Show
295
End Sub