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

9F. QuickBASIC
II. SOFTWARE GUIDES - 9. Driver488/SUB
II-164
Personal488 User’s Manual, Rev. 3.0
We then wait for the ADC488 to start the acquisition process. Once the acquisition is complete, which
is determined by the MSB of the ADC488’s serial poll response, the buffer pointer of the ADC488 is
reset (
B0
).
rv% = ioOutput& (adc%, “G10I3N100T1X”)
WHILE ((ioSPoll% (adc%) AND 32) = 0) : WEND
rv% = ioTrigger% (adc%)
WHILE ((ioSPoll% (adc%) AND 128) = 0) : WEND
rv% = ioOutput& (adc%, “BOX”)
Next, we fill the buffer with 100 readings from the ADC488. The
noterm
terminator structure is used
to disable scanning for terminators such as carriage-return and line-feed.
noterm.eoi = 0
noterm.nChar = 0
hundred$ = SPACES (200)
rv% = ioEnterX& (adc%, hundred$, 200, 1, noterm, 1, 0)
The
EnterX
function will use a DMA transfer if available. Because DMA transfers are performed
entirely by the hardware, the program can continue with other work while the DMA transfer function
occurs. For example, the program will process the previous set of data while collecting a new set of
data into a different buffer. However, before processing the data we must wait for the transfer to
complete. For illustration purposes, we query the Driver488/SUB status both before and after waiting.
rv% = ioStatus% (ieee%, substat)
CALL showstat (substat)
rv% = ioWait% (adc%)
rv% = ioStatus% (ieee%, substat)
CALL showstat (substat)
Now we process the buffer:
FOR i = 0 to 99
PRINT CVI (MID$ (hundred$, i * 2 +1, 2)) ;
IF ((iMOD 10) = 9) THEN PRINT
NEXT I
The above functions provide enough functionality for a basic data acquisition program. Additional
functions provided by Driver488/SUB are described in the “Section III: Command References” of this
manual.
Sample Program
‘$INCLUDE:’iotmqb45.def’
DECLARE SUB showstat (substat AS IeeeStatus)
COMMON SHARED adc%, ieee%, dev%
DIM hundred$ (200) , response$ (256), i%, voltage!, sum!, substat AS
IeeeStatus
DIM rv%, noterm AS terms
‘ establish communications with Driver488/SUB
ieee% = ioOpenName% (“IEEE”)
IF (ieee% = -1) THEN PRINT “Cannot initialize IEEE system.”: END
‘ Disable the automatic onscreen error display
rv% = ioError% (ieee%, TURNOFF)
‘ Open the ADC488 device handle or create if necessary
adc% = ioOpenName% (“ADC”)
IF (adc% = -1) THEN
response$ = SPACE$ (256)
rv% = ioGet Error% (ieee%, response$)
dev% = ioOpenName% (dev%, “ADC”)
rv% = ioBusAddress% (adc%, 14, -1)
END IF