beautypg.com

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

Page 170

background image

II. SOFTWARE GUIDES - 9. Driver488/SUB

9E. C Languages

Personal488 User’s Manual, Rev. 3.0

II-155

printf (“ trigger overrun\n”) ;

if (stadc&0x04)

printf (“ Buffer overrun\n”) ;

if (stadc&0x08) {

/* Read and interpret the ADC488 error status */
printf (“ ADC488 error\n”) ;
Output (adc,”E?”) ;
Enter (adc,errtext) ;
sscanf (errtext,”E%d”,&errnum) ;
if (errnum&0x01)

printf (“ Invalid DDC\n”) ;

if (errnum&0x02)

printf (“ Invalid DDC option\n”) ;

if (errnum&0x04)

printf (“ Conflict error\n”) ;

if (errnum&0x08)

printf (“ NVRAM setup error\n”) ;

if (errnum&0x10)

printf (“ Calibration error\n”) ;

if (errnum&0x20)

printf (“ NVRAM calibration error\n”) ;

}
if (stadc&0x20)

printf (“ Ready\n”) ;

if (stadc&0x40)

printf (“ SRQ asserted\n”) ;

if (stadc&0x80)

printf (“ Data acquisition complete\n”) ;

/* Set up interrupt pointers */
OnEvent (ieee, isr, (OpaqueP)0) ;

}

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 Driver488/SUB to

determine when a response is ready and to format the reply:

while((SPoll (adc) & 32) ==0) ;
Enter(adc,response) ;
sscanf(response,”%f”,&voltage) ;
printf(“ADC488 channel #1 reading valve is %g\n”,voltage) ;

Block Data Acquisition

First, we set up the ADC488 (

adc

) in the following configuration:

/* Setup the ADC488:

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

*/

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

).

Output(adc, “G10I3N100T1X”);

/* wait for the ready bit of the ADC488 to be asserted */
while ((SPoll(adc) & 32) == 0);

/* Trigger the ADC488 */
Trigger(adc);

/* wait for the acquisition complete bit of ADC488 to be asserted */
while ((SPoll(adc) & 128) == 0);