Programming Examples

1. Limit Testing

This program uses limit testing to check that the frequency is above a preset value.

50 CNTNAME$ = “DEV10"

60 CALL IBFIND (CNTNAME$, CNT%)

70

80

90—— Set continuous frequency measurement ——

100WRT$ = “*RST; *CLS; :FUNC ‘FREQ 1’; :INIT:CONT ON”

110CALL IBWRT (CNT%, WRT$)

120

130—— Enable limit monitoring, limit 1 MHz ——

140WRT$ = “:CALC:LIM ON; LIM:UPP 1E6; UPP:STATE ON”

150CALL IBWRT (CNT%, WRT$)

160WRT$ = “:STAT:DREG0:ENAB 2; *SRE 1"

170CALL IBWRT (CNT%, WRT$)

180

190—— Wait until the limit is passed ——

200PRINT “Waiting for limit to be passed”

210MASK% = &H800

220CALL IBWAIT (CNT%, MASK%)

230

240—— Read status and device status register ——

250CALL IBRSP (CNT%, SPR%)

260

270—— Read frequency ——

280WRT$ = “READ?”

290CALL IBWRT (CNT%, WRT$)

300MSG$ = SPACE$(255)

310CALL IBRD (CNT%, MSG$)

320PRINT “Frequency = ”; LEFT$(MSG$, IBCNT%)

330WRT$ = “:STAT:DREG0:EVEN?”

340CALL IBWRT (CNT%, WRT$)

350MSG$ = SPACE$(255)

360CALL IBRD (CNT%, MSG$)

370

380—— Disable continuous measurement ——

390WRT$ = “:INIT:CONT OFF”

400CALL IBWRT (CNT%, WRT$)

410END

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

Page 44
Image 44
Fluke PM6681R, PM6685R manual Limit Testing