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

II. SOFTWARE GUIDES - 9. Driver488/SUB
9E. C Languages
Personal488 User’s Manual, Rev. 3.0
II-157
/*Disable the automatic onscreen error display*/
Error (ieee,OFF) ;
/*Open the ADC488 devie handle or create if necessary*/
if ((adc=OpenName (“ADC”))==-1 {
GetError (ieee,response) ;
dev=OpenName (“DEVIEEE”) ;
adc=MakeDevice (dev,”ADC”) ;
BusAddress (adc,14,-1) ;
}
/* Read the Driver488/SUB revision number */
Hello (ieee,response) ;
printf (“%s\n”,response) ;
/*Set up interrupt pointers */
OnEvent (ieee,isr, (OpaqueP)0) ;
/*Enable Driver488/SUB interrupt on Error or Service Request */
Arm (ieee,acSRQ) ;
/*Display the Driver488/SUB system status */
Status (ieee,&substat) ;
showstat (&substat) ;
/*Put the ADC488 into remote mode */
Remote (adc) ;
/*Clear the ADC488*/
Clear (adc) ;
/*Enable ADC488 SRQ on command errors */
Output (adc,”M8X”) ;
/*Send an invlaid command to the ADC488 */
printf (“Sending invalid ADC command\n”) ;
Output (adc,”V13X”) ;
/*Setup the ADC488:
Differential inputs (a0)
Scan grou channel 1 (C1)
Compensated ASCII floating-point output format (G0)
Channel 1 range to +/-10v (R3)
One-shot trigger on talk (T6)
*/
Output (adc,”A0C1G0R3T6X”) ;
/*Wait for the ready bit of the ADC488 to be asserted */
while ((SPoll (adc) & 32 ==0) ;
/*Display a reading */
Enter
(adc,reponse) ;
sscanf (response,”%f”,&voltage) ;
printf (“ADC488 channel #1 reading value is %g\n”,voltage) ;
/*Display the average of 10 readings */
sum=0.0 ;
for (i=0;i;i++) {
Enter (adc,response) ;
sscanf (response,”%f”,voltage) ;
sum=sum+voltage;
}
printf (“The average of 10 readings is %g\n”,sum/10.0) ;
/*Setup the ADC488:
Compensated binary output format (G10)