Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual
Page 261

10F. Visual Basic
II. SOFTWARE GUIDES - 10. Driver488/W31
II-246
Personal488 User’s Manual, Rev. 3.0
Sub Acquire_Click ()
Handle = OpenName(“ADC488")
Err = ioClear(Handle)
cmd$ = ”C" + Str$(Chan.ListIndex + 1) + “R” + Str$(Rng) + “T0X”
Err = ioOutput(Handle, cmd$)
StartFlag = 1
End Sub
The acquisition actually takes place in the
Timer
service routine. If the acquisition took place in the
Acquire_Click
service routine, it might never relinquish control to the user again, collecting readings
forever.
At design time, the timer interval was set to
500
which translates to a
500 ms
period. The service
routine for the timer checks the
StartFlag
. If the value is
1
, the routine collects data from the
ADC488/16A via the
Enter
command. After getting a reading, the new reading is appended to the
existing string using
NL
as a data separator:
Sub Timer1_Timer ()
If StartFlag = 1 Then
Err = Enter(Handle, resp)
text1.text = text1.text + NL + resp
End If
End Sub
The Stop button executes the
Stopper_Click
routine, setting the
StartFlag
back to
0
, ending the
acquisition, then closes the device ADC488 via its
Handle
:
Sub Stopper_Click ()
StartFlag = 0
Err = ioClose(Handle)
End Sub
The Copy Link button executes the
CopyLink_Click
routine, posting the server link information in
the clipboard. First the clipboard is cleared, then the link information is inserted.
Sub CopyLink_Click ()
Clipboard.Clear
Clipboard.SetText “ADC488|Form1|text1”’ &HBF00
End Sub
While this application is running, pressing the Copy
Link button seems to have no effect. After starting the
Excel program, we select several cells in a column,
then click Paste Link under the Edit menu. Returning
to the application, we click the Acquire button. The
data immediately begins flowing into the text box.
Soon after, the Excel spreadsheet column begins to
reflect the new data from the application, as indicated
in the following two screens.
Acquisition Engine Form with Data