beautypg.com

Interrupt handling, Basic data acquisition, Block data acquisition – Measurement Computing Personal488 rev.3.0 For DOS & Windows 3.Xi User Manual

Page 178

background image

II. SOFTWARE GUIDES - 9. Driver488/SUB

9F. QuickBASIC

Personal488 User’s Manual, Rev. 3.0

II-163

Interrupt Handling

In case we send out an invalid command, either due to a programming error or an unanticipated
condition in the equipment, Driver488/SUB will automatically notify the interrupt handling function as
established above:

rv% = ioOutput & (adc%, “V13X”)

The interrupt handler as established above might consist of a function similar to the following:

‘ Interrupt service routine for Driver488/SUB interrupts
isr :
‘ Print isr message to screen
PRINT “ In interrupt handler”

‘ Check if the intrrupt was due to a Service Request
sp% = ioSPoll % (ieee%)
IF (sp% = 0) THEN PRINT “ No SRQ detected”: END

‘ Check that the Service Request ws from the ADC488
stadc% = ioSPoll%(adc%)
IF ((stadc% AND 64) = 0) THEN PRINT “ Not an ADC488 SRQ.”: END

‘ Interpret the Serial Poll response
IF ((stadc% AND 1) >0) THEN PRINT “Triggered”
IF ((stadc% AND 2) >0) THEN PRINT “Trigger overrun”
IF ((stadc% AND 4) >0) THEN PRINT “Buffer overrun”
IF ((stadc% AND 8) >0) THEN

‘ Read and interpret the ADC488 error status
PRINT “ ADC488 error”
rv% = ioOutput & (adc%, “E?”)
errtext$ = SPACE$ (64)
rv% = ioEnter& (adc%, errtext$)
errnum% = VAL (RIGHT$ (errtex$, LEN (errtext$) - 1))
IF ((errnum AND 1) >0) THEN PRINT “ Invalid DDC”
IF ((errnum AND 2) >0) THEN PRINT “ Invalid DDC option”
IF ((errnum AND 4) >0) THEN PRINT “ Conflict error”
IF ((errnum AND 8) >0) THEN PRINT “ NVRAM setup error”
IF ((errnum AND 16) >0) THEN PRINT “ Calibration error”
IF ((errnum AND 32) >0) THEN PRINT “ NRRAM calibration error”

END IF
IF ((stadc% AND 32) >0) THEN PRINT “ ready “
IF ((stadc% AND 64) >0) THEN PRINT “ SRQ asserted”
IF ((stadc% AND 128) >0) THEN PRINT “ Data acquisition complete”
RETURN

Basic Data Acquisition

With both Driver488/SUB and the external device ready for action, we next might try taking a simple
reading using the ADC488. Here, we use the serial poll (

SPoll

) capabilities of the system to

determine when a response is ready and format the reply.

WHILE ((ioSPoll%(adc%) AND 32) = 0) : WEND
response$ = SPACE$ (256)
rv% = ioEnter& (adc%, response$)
voltage ! = VAL (reponse$)
PRINT “ADC488 channel #1 rading value is “; voltage!

Block Data Acquisition

First, we set up the ADC488 (

adc

) in the following configuration:

Compensated binary output format (G10)
100 usec scan interval (I3)
No pre-trigger scans = 0, 100 post-trigger scans (N100)
Continuous trigger on GET (T1)