Figure 12 Programming Example - Fluke 1560 Black Stack User Manual

Thermometer readout
Table of Contents

Advertisement

6 Digital Communications Interface
Programming Example
1 'This example continually reads temperature from the Hart 1560.
2 'Connect the 1560 serial port to the COM2 port of the computer.
3 'Set the BAUD rate of the 1560 to 2400.
4 'Set DUPLEX to HALF.
5 'Set LINEFEED to OFF.
6 '
8 'open COM2 port, 2400 baud, no parity, 8 data bits, 1 stop bit
9 'disable handshaking
10 OPEN "COM2:2400,N,8,1,CD0,DS0,CS0" FOR RANDOM AS #1
19 'reset all operating parameters to defaults
20 PRINT #1, "*RST"
29 'select channel 1
30 PRINT #1, "ROUT:CLOS (@1)"
39 'set to measure continuously
40 PRINT #1, "INIT:CONT ON"
49 'clear status registers
50 PRINT #1, "*CLS"
100 'main loop
110 K$=INKEY$: IF K$<>"" GOTO 500 'quit if any key pressed
120 GOSUB 1000 'read a new measurement
130 PRINT A$ 'print to the screen
140 GOTO 100
500 'end program
510 CLOSE
520 END
1000 'SUB: read one new measurement
1010 'wait for new measurement complete
1020 CNT2 = 0 'measurement timeout counter
1030 PRINT #1, "STAT:OPER?" 'request status
1040 GOSUB 1200 'read status
1050 IF VAL(A$) AND 16 THEN 1100 'measurement complete
1060 GOSUB 1300 'wait .1 sec.
1070 CNT2 = CNT2+1
1080 IF CNT2>20 THEN 1150 ELSE 1030 'timeout after 2 sec.
1100 'read new measurement
1110 PRINT #1, "FETC?" 'request measurement
1120 GOSUB 1200 'read measurement
1130 RETURN
1150 PRINT "Error: Not measuring"
1160 CLOSE: END
1200 'SUB: read response
1210 CNT1 = 0 'response timeout counter
1220 IF NOT EOF(1) GOTO 1260 'response sent
1230 GOSUB 1300 'wait another .1 sec
1240 CNT1= CNT1+1
1250 IF CNT1>20 THEN 1280 ELSE 1220 'timeout after 2 sec.
1260 LINE INPUT #1, A$ 'read response
1270 RETURN
1280 PRINT "Error: No response" 'timeout
1290 CLOSE: END
1300 'SUB: wait for .1 second
1310 T=TIMER
1320 IF TIMER<T+.1 THEN 1320
1330 RETURN

Figure 12 Programming Example

111

Advertisement

Table of Contents
loading

Table of Contents