beautypg.com

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

Page 173

background image

9E. C Languages

II. SOFTWARE GUIDES - 9. Driver488/SUB

II-158

Personal488 User’s Manual, Rev. 3.0

100u sec scan interval (I3)
No pre-trigger scans, 100 post-trigger scans (n100)
Continuous trigger on GET (T1)

*/
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 to be asserted*/
while ((SPoll (adc) &128)==0) ;

/*Reset the buffer pointer of the ADC488 */
Output (adc,”BOX”) ;

/*Take 100 readings from the ADC488* /
noterm.EOI=0;
noterm.nChar=0;
EnterX(adc, (char*)hundred,200,1,¬erm,1,0L);

/*Check the Status before and after waiting */
Status (ieee,&substat) ;
showstat (&substat) ;

/* Wait for completion of input operation */
Wait (adc);

/*Display the Driver488/SUB system status */
Status (ieee,&substat) ;
showstate (&substat) ;

/* Print the received characters */
for (i=0;id;i++) {

printf(“%6d”,hundred[i]) ;
if ((i%10)==9)

printf (“\n”) ;

}

}

/*Interrupt service routine for Driver488/SUB interrupts */
void isr (OpaqueP param) {

int

sp,
stadc,
errnum;

char

errtext [64] ;

/*Print parameter passed to isr to screen */
printf (“ In interrupt handler, param=%d\n”,param) ;

/* Check if the interrupt was due to a Service Request */
sp=SPoll (ieee) ;
if (sp==0) {

printf (“ No SRQ detected\n”) ;
exit (1) ;

}

/* Check that the Service Request was from the ADC488 */
stadc=SPoll (adc) ;
if ((stadc&0x40)==0) {

printf(“ Not an ADC488 SRQ.\n”) ;
exit (1) ;

}

/* Interpret the Serial Poll response */