beautypg.com

Sample programs – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 262

background image

II. SOFTWARE GUIDES - 10. Driver488/W31

10F. Visual Basic

Personal488 User’s Manual, Rev. 3.0

II-247

From Excel, this can be turned into a cold link, where
the column of the spreadsheet is updated only when the
user requests an update. In Excel, click Links... under
the File menu. A list of the present links is displayed.
Selecting the newly active link and clicking the option
button, brings up a dialog box with a check box for
enabling and disabling automatic link updates.

If the ADC488 application is terminated, the data in the
spreadsheet will become static. If we ask for the data
to be updated, the Excel spreadsheet will make an
attempt to start the application.

The following program listing includes the ADC488
Acquisition Engine program. This program was
designed to outline the basic concepts of DDE. For
further information on DDE, consult your Visual Basic
User Manual or Help system.

Sample Programs

Data Acquisition Sample Program

GLOBAL.BAS Declarations

Declare Function FindWindow Lib “User” (ByVal data1$, ByVal data2$)
As Integer

Declare Function SendMessage Lib “User” (ByVal winHandle%, ByVal
message%, ByVal wp%, ByVal lp As Long) As Integer

Declarations included in Form

Dim nl As String * 2
Dim mystring As String
Dim substat As IeeeStatus
Dim adc As Integer
Dim response as String * 256
Dim intResp(500) As Integer
Dim voltage As Single
Dim noterm As terms
Dim sample As String * 7

Source Code

Sub Command1_Click ()
nl = Chr$(13) + Chr$(10)

TextWindow.Text = “”

‘open driver . . .
ieee% = OpenName (“IEEE”)
If (ieee% = -1) Then

MsgBox “Cannot initialize IEEE system”
End

End If

‘Open device named ADC

Excel Spreadsheet with ADC488/16A Data