HA243821
Issue 5 Mar 98
Section5
Page 5 - 49
MODEL 346 INSTALLATION AND OPERATION MANUAL
5.7.8 BASIC PROGRAM LISTING (Cont.)
1000 REM=======================================================================
1010 REM Get a reply from the instrument
1020 Z1=TIMER+.8
:REM Instrument latency
1030 ANSWER$=””
1040 WHILE TIMER<Z1 :WEND
1050 WHILE LOC(1)
:REM Get next char. and wait 30ms.
1060
IF LOC(1) THEN ANSWER$=INPUT$(LOC(1),#1)
1070
Z1 = TIMER + .03: WHILE TIMER <Z1:WEND
:REM 1 character at 300 Baud
1080 WEND
1090 RETURN
2000 REM=======================================================================
2010 REM To send an enquiry
2020 Q$=G$+G$+U$+U$+C$+M$
2030 WRITE$=CHR$(4)+Q$+CHR$(5)
:REM EOT GGUUCMn ENQ
2040 RETURN
3000 REM=======================================================================
3010 REM Writing
3020 WRITE$=CHR$(4)+G$+G$+U$+U$+CHR$(2)
:REM EOT GGUU STX
3030 Q$=C$+M$+V$+CHR$(3)
:REM CMnValue ETX
3040 WRITE$=WRITE$+Q$
3050 B=0
3060 FOR N = 1 TO LEN(Q$)
:REM IF THE HOST SUPPORTS XOR
3070
T = ASC(MID$(Q$,N,1))
:REM REPLACE LINES 3080 TO 3190 INC.
3080
FOR M = 1 TO 8
REM WITH “B = ASC(MID$(Q$,N,1)) XOR B”
3090
T=T/2
3100
TE=FIX(T)
3110
IF TE-T<>0 THEN O(M)=1 ELSE O(M)=0
3120
IF B(M)<>0 THEN B(M)=1 ELSE B(M)=0
3130
T=TE
3140
NEXT M:
3150 NEXT N:
3160 FOR M = 1 TO 8
3170
B = B + 2^(M-1) * B(M)
3180
B(M)=0:
3190 NEXT M
3200 WRITE$ = WRITE$ + CHR$(B)
:REM Append BCC character
3210 RETURN
Notes...
1. Where more than one statement (including REMark) is made on one line, the statements must be separated
by a colon.
2. To leave the program, press <Shift><Ctrl><Break> simultaneously.