beautypg.com

Reading driver status, External device initialization – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 254

background image

II. SOFTWARE GUIDES - 10. Driver488/W31

10F. Visual Basic

Personal488 User’s Manual, Rev. 3.0

II-239

Finally, the ADC488 is setup to complete an acquisition and assert

SRQ

.

‘Clear ADC
rv% = ioClear (adc)

‘Set up event handling for trapping the SRQ
Event4881.Handle = adc
Event4881.SRQ = -1

“Enable ADC to SRQ on acquisition complete
rv% = ioOutput (adc, ”M128X")

‘Setup the ADC488:
‘100 uSec scan interval (I3)
‘No pre-trigger scans, 100 post-trigger scans (N100)
‘Continuous trigger on GET (T1)
rv% = ioOutput (adc, “13N100T1X”)

‘Trigger the ADC488
rv% = Trigger (adc)

Reading Driver Status

Your application may interrogate Driver488/W31 at any time to determine its status and other
information.

Status

information is returned in a structure provided by the application and can be

displayed by the function shown below.

rv% = Status(ieee%, substat)
Call showstat (substat)

Another function to display the information contained in the

Status

structure could be:

Sub showstat (substat As IeeeStatus)

nl = Chr$(13) + Chr$(10)
mystring = “”
mystring = mystring + “SC:” + Str$ (substat.SC) + nl
mystring = mystring + “CA:” + Str$ (substat.CA) + nl
mystring = mystring + “PrimAddr:” + Str$ (substat.PrimAddr) + nl
mystring = mystring + “SecAddr:” + Str$ (substat.SecAddr) + nl
mystring = mystring + “SRQ:” + Str$ (substat.SRQ) + nl
mystring = mystring + “addrChange:” + Str$ (substat.addrChange) + nl
mystring = mystring + “talker :” + Str$ (substat.talker) + nl
mystring = mystring + “listener:” + Str$ (substat.listener) + nl
mystring = mystring + “triggered:” + Str$ (substat.triggered) + nl
mystring = mystring + “cleared:” + Str$ (substat.cleared) + nl
mystring = mystring + “transfer:” + Str$ (substat.transfer) + nl
mystring = mystring + “byteIn :” + Str$ (substat.byteIn) + nl
mystring = mystring + “byteOut

:” + Str$ (substat.byteOut) + nl

TextWindow.Text = TextWindow.Text + RTrim$ (mystring)

End Sub

External Device Initialization

Refer to the device manufacturer’s documentation for specific requirements for initializing your
IEEE 488 instrument. In the case of the ADC488, appropriate initialization involves sending it a

ioClear

command and placing it into

Remote

mode:

rv% = ioClear(adc)
rv% = Remote(adc)

For our hypothetical application, we also wish to have the ADC488 generate a service request should it
detect a command error. This involves sending a command string consisting of textual data to the
ADC488:

rv% = ioOutput (adc, “M8X”)

We may also wish to perform other initialization and configuration. In this case, we set up the
ADC488 (

adc

) in the following configuration: