beautypg.com

Quickbasic, 9f. quickbasic, Accessing from a quickbasic program – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 175: Establishing communications, Topics

background image

9F. QuickBASIC

II. SOFTWARE GUIDES - 9. Driver488/SUB

II-160

Personal488 User’s Manual, Rev. 3.0

Accessing from a QuickBASIC Program

Driver488/SUB provides support for Microsoft QuickBASIC. To allow for ready access to all
Driver488/SUB functions and type definitions, a definition file provides all required declarations. Note
the definition file (

*.def

) must be included in your program and linked to the proper Driver488/SUB

library files, as described in the Sub-Chapter “Getting Started” earlier in this Chapter. The following

$include

directives should appear near the beginning of the program:

‘$include: ‘IOTMQB45.DEF’

The following declarations are assumed throughout the remainder of this discussion.

DIM adc%,adc2%,ieee%,dev,% ’ Device handles
DIM hundred% (100) ;

’ Driver488/SUB status structure

DIM response$ (256)

’ Text buffer for Driver488/SUB responses

DIM i%

’ General purpose loop counter

DIM voltage !

’ Single reading variable

DIM sum !

’ Summation used to compute average

DIM substat as Ieee status ’ Driver488/SUB status structure
DIM sp%,stadc%

’ Driver488/SUB and ADC488 spoll response

DIM errnum%

’ ADC488 error number

DIM errtext$ (64)

’ ADC488 error response

DIM rv%

’ Driver488/SUB return value

DIM noterm as terms

’ Driver488/SUB terminator structure

Establishing Communications

For the sake of this discussion, assume that Driver488/SUB has been configured to start with a
configuration including the devices

IEEE

(IEEE 488 interface) and

ADC

(ADC488/8S connected to the

IEEE 488 interface). Additional interfaces and/or devices may also have been defined, as the driver
can support up to four interfaces and 56 devices simultaneously. To open the two devices of interest,
we use the following statements:

ieee% = ioOpenName% (“IEEE”)
adc% = ioOpenName% (“ADC”)

If the

ADC

was not configured within Driver488/SUB, it can be optionally created “on the fly.” First

verify that opening the

ADC

failed, then use the

GetError

command to clear the error condition

generated by this failure. Next, use the handle of the device

DEVIEEE

, which is always available within

9F. QuickBASIC

Topics

Accessing from a QuickBASIC Program ................................. II-159

Establishing Communications................................................... II-159

Confirming Communications..................................................... II-160

Setting Up Event Handling ........................................................ II-160

Reading Driver Status ................................................................. II-161

External Device Initialization ................................................... II-161

Interrupt Handling ...................................................................... II-162

Basic Data Acquisition ................................................................ II-162

Block Data Acquisition................................................................ II-162

Sample Program ........................................................................... II-163

Command Summary..................................................................... II-166