2620A, 2625A
Users Manual
4-10
10 ’ EXAMPLE.BAS Hydra program to scan VDC, VAC, OHMS, FREQ, or TEMP
20 ’ - initialize RS232 communication and set up Hydra
30 ’ - display and record measurement data in "TESTDATA.PRN"
40 ’ Hydra must be set up for RS232, 9600 baud, no parity (from front panel)
50 KEY OFF
60 ’ Open communications port 9600 baud, no parity, 8 bit data,
70 ’ ignor Clear to Send, Data Set Ready, Carrier Detect
80 OPEN "COM1:9600,N,8,,cs,ds,cd" FOR RANDOM AS #1
90 IF ERRORCODE <> 0 THEN PRINT "ERROR - Could not open com1:" : END
100 ’
110 OPEN "testdata.prn" FOR OUTPUT AS #2 ’Open data file
120 IF ERRORCODE <> 0 THEN PRINT "ERROR - Could not open data file" : END
130 ’
140 PRINT #1, "ECHO 0" ’Turn off command echo
150 ’
160 NUMBEROFCHANS = 0
170 WHILE (NUMBEROFCHANS < 1) OR (NUMBEROFCHANS > 20)
180 INPUT "Enter number of channels (1-20): ", NUMBEROFCHANS
190 WEND
200 PRINT "(Wait...)"
210 FOR I = (NUMBEROFCHANS + 1) TO 20 ’ Turn unused channels off
220 PRINT #1, "FUNC" + STR$(I) + ",OFF"
230 GOSUB 800
240 NEXT I
250 ’
260 CLS
270 LOCATE 2,25 : PRINT "Sample Program for Hydra"
275 PRINT #1, "*IDN?" : GOSUB 800 : LINE INPUT #1, RESULT$
276 LOCATE 3,20 : PRINT RESULT$;
280 ’
290 WHILE (1)
300 ’ Print banner line at bottom of screen
310 LOCATE 25,1
320 PRINT "1 = VDC 2 = VAC 3 = OHMS 4 = FREQ 5 = TEMP 6 = QUIT";
330 ’
340 FUNC$ = "0"
350 WHILE (FUNC$ < "1") OR (FUNC$ > "6")
360 LOCATE 23,1 : INPUT " Selection: ", FUNC$
370 WEND
380 ’ Exit and clean up if "Quit"
390 If FUNC$ = "6" THEN CLOSE 1, 2 : CLS : KEY ON : END
400 ’
410 ’ Set up later part of command string to Hydra (function and range)
420 IF FUNC$ = "1" THEN CMD$ = "VDC, 1"
430 IF FUNC$ = "2" THEN CMD$ = "VAC, 1"
440 IF FUNC$ = "3" THEN CMD$ = "OHMS, 1, 2"
450 IF FUNC$ = "4" THEN CMD$ = "FREQ, 1"
460 IF FUNC$ = "5" THEN CMD$ = "TEMP, K"
470 ’
480 ’ Set up Hydra
485 LOCATE 23,1 : PRINT "Programming... ";
490 FOR I = 1 TO NUMBEROFCHANS ’ Program channels
Figure 4-2. Sample Program