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