Fluke PM6685R, PM6681R manual 4-18 ‘C’ for National Instruments PC-IIA, Fast Sampling

Models: PM6685 PM6685R PM6681 PM6681R

1 276
Download 276 pages 1.51 Kb
Page 58
Image 58
4-18 ‘C’ for National Instruments PC-IIA, Fast Sampling

Programming Examples

4. Fast Sampling

This program makes a quick array measurement and stores the results in the internal memory of the counter. Then it writes the results to a file called MEAS.DAT. The measurement results as a function of the samples can be visualized in a spreadsheet program, such as Excel.

#include “decl.h” #include <stdio.h> #include <process.h> #include <string.h>

main ()

{

 

int

Counter, Status, i;

char

InString[80];

FILE

*ofp;

if (ofp = fopen(“MEAS.DAT”, “w”)) {

Counter = ibfind(“DEV10");

/*Clear status*/ ibwrt(Counter, “*CLS”, 4);

/*Enable 1000 measurement with maximum speed*/ ibwrt(Counter, “:TRIG:COUN 1000; :ARM:COUN 1", 28); ibwrt(Counter, “:INP:LEV:AUTO ONCE; :CAL:INT:AUTO OFF”, 37); ibwrt(Counter, “:DISP:ENAB OFF; :INT:FORM PACKED”, 32); ibwrt(Counter, “:ACQ:APER MIN; :AVER:STAT OFF”, 32);

/**Enable SRQ on operation complete**/ ibwrt(Counter, “*ESE 1; *SRE 32", 15);

/*Start measurement*/ printf(“Measuring\n”); ibwrt(Counter, “INIT; *OPC”, 10);

/*Wait for operation complete*/ ibwait(Counter, RQS);

/**Read status and event status register**/ ibrsp(Counter, &Status);

ibwrt(Counter, “*ESR?”, 5);

4-18 ‘C’ for National Instruments PC-IIA, Fast Sampling

Page 58
Image 58
Fluke PM6685R, PM6681R manual 4-18 ‘C’ for National Instruments PC-IIA, Fast Sampling