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 ——
100 WRT$ = “*RST; *CLS; :FUNC ‘FREQ 1’; :INIT:CONT ON”
110 CALL IBWRT (CNT%, WRT$)
120 ‘
130 ‘ —— Enable limit monitoring, limit 1 MHz ——
140 WRT$ = “:CALC:LIM ON; LIM:UPP 1E6; UPP:STATE ON”
150 CALL IBWRT (CNT%, WRT$)
160 WRT$ = “:STAT:DREG0:ENAB 2; *SRE 1"
170 CALL IBWRT (CNT%, WRT$)
180 ‘
190 ‘ —— Wait until the limit is passed ——
200 PRINT “Waiting for limit to be passed”
210 MASK% = &H800
220 CALL IBWAIT (CNT%, MASK%)
230 ‘
240 ‘ —— Read status and device status register ——
250 CALL IBRSP (CNT%, SPR%)
260 ‘
270 ‘ —— Read frequency ——
280 WRT$ = “READ?”
290 CALL IBWRT (CNT%, WRT$)
300 MSG$ = SPACE$(255)
310 CALL IBRD (CNT%, MSG$)
320 PRINT “Frequency = ”; LEFT$(MSG$, IBCNT%)
330 WRT$ = “:STAT:DREG0:EVEN?”
340 CALL IBWRT (CNT%, WRT$)
350 MSG$ = SPACE$(255)
360 CALL IBRD (CNT%, MSG$)
370 ‘
380 ‘ —— Disable continuous measurement ——
390 WRT$ = “:INIT:CONT OFF”
400 CALL IBWRT (CNT%, WRT$)
410 END
Programming Examples
4-4 GW-Basic for National Instruments PC-IIA, Setting Up the Interface