Programming Examples

6. Statistics

(Only for PM6680B and PM6681)

In this example, the counter makes 10000 measurements and uses the statistical func- tions to determine MAX, MIN, MEAN, and Standard Deviation. All four results are sent to the controller.

50 CNTNAME$ = “DEV10"

60 CALL IBFIND (CNTNAME$, CNT%)

70

80

90WRT$ = “*RST; *CLS; *SRE 16; :FUNC ‘Freq 1’; :ACQ:APER MIN”

100CALL IBWRT (CNT%, WRT$)

110WRT$ = “:INP:LEV:AUTO Off”

120CALL IBWRT (CNT%, WRT$)

130

140—— Enable statistics on 10000 measurements ——

150WRT$ = “:CALC:AVER:STAT ON; COUN 10000"

160CALL IBWRT (CNT%, WRT$)

170

180‘ ==== Start measurement ====

190WRT$ = “:Init; *OPC?”

200CALL IBWRT (CNT%, WRT$)

210

220—— Wait for operation complete (MAV) ——

230PRINT “WAITING FOR MEASUREMENT TO GET READY”

240MASK% = &H800

250CALL IBWAIT (CNT%, MASK%)

260

270—— Read status and response ——

280CALL IBRSP (CNT%, SPR%)

290MSG$ = SPACE$(255)

300CALL IBRD (CNT%, MSG$)

310

320—— Maximum ——

330WRT$ = “:CALC:AVER:TYPE MAX; :CALC:IMM?”

340CALL IBWRT (CNT%, WRT$)

350MSG$ = SPACE$(255)

360CALL IBRD (CNT%, MSG$)

370PRINT “MAXIMUM = ”; LEFT$(MSG$, IBCNT%)

380

390—— Minimum ——

400WRT$ = “:CALC:AVER:TYPE MIN; :CALC:IMM?”

410CALL IBWRT (CNT%, WRT$)

420MSG$ = SPACE$(255)

GW-Basic for National Instruments PC-IIA, Setting Up the Interface 4-11

Page 51
Image 51
Fluke PM6681R, PM6685R manual Statistics, Print Waiting for Measurement to GET Ready