beautypg.com

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

Page 181

background image

9F. QuickBASIC

II. SOFTWARE GUIDES - 9. Driver488/SUB

II-166

Personal488 User’s Manual, Rev. 3.0

‘ Wait for the ready bit of the ADC488 to be asserted
WHILE ((isSPoll%(adc%)AND 32) = 0 ) : WEND

‘ Trigger the ADC488
rv% = ioTrigger% (adc%)

‘ Wait for the data acquisition bit of the ADC488 to be asserted
WHILE ((ioSPoll%(adc%) AND 128) = 0) : WEND

‘ Reset the buffer pointer of the ADC488
rv% = ioOutput& (adc%, “BOX”)

‘ Take 100 readings from the ADC488
noterm.eoi = 0
noterm.nChar = 0
hundred$ = SPACE$ (200)
rv% = ioEnterX& (adc%, hundred$, 200, 1, noterm, 1, 0)

‘ Check the Status before and after waiting
rv% = ioStatus% (ieee%, substat)
CALL showstat (substat)

‘ Wait for completion of input operation
rv% = ioWait% (adc%)

rv% = ioStatus% (ieee%, substat)
CALL showstat (substat)

‘ Print the received characters
FOR i = 0 to 99

PRINT CVI (MID$ (hundred$, i, * 2 + 1, 2)) ;
IF ((i MOD 10) = 9) THEN PRINT

NEXT i

END

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

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

‘ Check that the Service Request was from the ADC488
stadc% = isSPoll% (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$ (errtext$, 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 “ NVRAM calibration error”

END IF