Measurement-computing Personal488 rev.3.0 For DOS & Windows 3.Xi Manual de usuario Pagina 231

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 400
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 230
10E. C Languages II. SOFTWARE GUIDES - 10. Driver488/W31
II-216 Personal488 Users Manual, Rev. 3.0
/* Now acquire and display the average of 10 readings */
sum = 0.0;
for (i=0;i<10;i++) {
Enter(adc,response);
sscanf(response,"%lf",&voltage);
sum+=voltage;
}
sum/=10.0;
sprintf(response, The average of 10 readings is %lf\r\n, sum);
strcat(textstr, response);
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 ADC488s 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);
/* Reset the buffer pointer of the ADC488 */
Output(adc, B0X);
Next, we fill the buffer with 100 readings from the ADC488. Since the data being returned from the
ADC488 is in a binary format, the
noterm
terminator structure is used to disable scanning for
terminators such as carriage return and line feed.
noterm.EOI = 0;
noterm.nChar = 0;
EnterX(adc, (char *)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/W31 status both before and after waiting.
/* Display DRIVER488/W31 status */
Status(ieee, &substat);
showstat(&substat, textstr);
/* Wait for completion of input operation*/
Wait(adc);
/* Display DRIVER488/W31 status */
Status(ieee, &substat);
showstat(&substat, textstr);
Vista de pagina 230
1 2 ... 226 227 228 229 230 231 232 233 234 235 236 ... 399 400

Comentarios a estos manuales

Sin comentarios