'********************************************************************* '* * '* QuickBASIC SAMPLE 3:QSAMPLE3.BAS * '* * '* This sample demonstrates the use of an AIM-16 sub-mulitplexer card* '* with the AIO8. It also shows how to set up the driver to measure * '* temperature and to use the reference junction on the AIM-16. This * '* program is identical to sample 1 except that auto initialization * '* from the SETUP.CFG configuration file is used. * '* * '* LAST MODIFICATION: 2/4/98 * '* * '********************************************************************* ' Dimension the parameter passing variables. DIM TASK%, STAT%, PARAM%(5) ' Dimension some buffers. You need data and point buffers. DIM DATBUF%(20), PNTBUF%(20) ' Place all arrays in same segment for use with driver in QB environment COMMON SHARED PARAM%(), DATBUF%(), PNTBUF%() ' This is the driver entry point declaration DECLARE SUB AIO8DRV (TASK%, BYVAL PARAM%, STAT%) CLS ' Initial screen display PRINT " SAMPLE 1 AIO8" PRINT : PRINT : PRINT : PRINT PRINT "This sample will display sixteen analog inputs." PRINT : PRINT PRINT "Board Configuration :" PRINT PRINT " -- BASE ADDRESS: as assigned in SETUP.CFG file" PRINT " -- Needed jumper settings are explained in SETUP.CFG file" PRINT : PRINT : PRINT PRINT "Please press return to continue."; INPUT "", xx$ ' initialize the driver TASK% = 0 PARAM%(2) = 0 'auto initialization mode GOSUB handler 'program the base address and int # 'set the sample and hold settle count, used for faster computers TASK% = 11 PARAM%(1) = 5 PARAM%(2) = 25 GOSUB handler C$ = " " DO UNTIL C$ = CHR$(27) TASK% = 11 'TASK 11 PARAM%(1) = 1 'reset the point list index back to 0 GOSUB handler ' Get and display 16 points TASK% = 8 PARAM%(1) = VARPTR(DATBUF%(1)) 'location to place data PARAM%(2) = VARPTR(PNTBUF%(1)) 'location to place gain/point address PARAM%(3) = 16 'requested # of samples GOSUB handler 'call driver CLS ROW = 5 COL = 10 LOCATE ROW, COL: PRINT "CH DATA GAIN" ROW = ROW + 1 LOCATE ROW, COL: PRINT "--- ------- ----" ROW = ROW + 1 FOR I = 0 TO 15 CH = (PNTBUF%(I + 1) AND &HFF00) / 256 DAT = DATBUF%(I + 1) * .1 GAIN = PNTBUF%(I + 1) AND &HFF LOCATE ROW + I, COL: PRINT USING "## ###.# #"; CH; DAT; GAIN NEXT I '----------------------- 'Wait for the operator. '----------------------- LOCATE ROW + 16, 10 PRINT PRINT "Press any key to rescan for data; press the [Esc] key to Quit"; C$ = INPUT$(1) LOOP END '************************************************************* ' DRIVER HANDLER ' ' This following section of code will call the driver for you ' handling the argument passing convention, then check the ' status after it returns and provide a couple of options if ' there was an error. '************************************************************* handler: STAT% = 0 CALL AIO8DRV(TASK%, VARPTR(PARAM%(1)), STAT%) IF STAT% THEN PRINT "TASK"; TASK%; "has error code"; STAT% DO PRINT "Try to continue with program or Exit (C/E)"; INPUT ans$ ans$ = UCASE$(ans$) IF ans$ = "C" THEN EXIT DO IF ans$ = "E" THEN END LOOP END IF RETURN