IBM 7220 Instruction Manual page 120

Dsp lock-in amplifier
Table of Contents

Advertisement

Appendix C, DEMONSTRATION PROGRAMS
100
B$=B$+CR$
110
GOSUB 180
120
GOSUB 310: PRINT Z$;
130
IF A$="?" THEN GOSUB 410: GOSUB 470
140
150 WEND
160 '
170 '
180 '...output the string B$..............
190 ON ERROR GOTO 510
200 IF LOC(1)>0 THEN A$=INPUT$(LOC(1),#1)
210 ON ERROR GOTO 0
220 FOR J1%=1 TO LEN(B$)
230
C$=MID$(B$,J1%,1): PRINT#1,C$;
240
WHILE LOC(1)=0: WEND
250
A$=INPUT$(1,#1)
260
IF A$<>C$ THEN PRINT"handshake error"
270 NEXT J1%
280 RETURN
290 '
300 '
310 '....read response..................
320 A$="": Z$=""
330 WHILE (A$<>"*" AND A$<>"?")
340
Z$=Z$+A$
350
WHILE LOC(1)=0: WEND
360
A$=INPUT$(1,#1)
370 WEND
380 RETURN
390 '
400 '
410 '....fetch status byte..............
420 B$="ST"+CR$
430 GOSUB 180
440 GOSUB 310
450 STATUS%=VAL(Z$)
460 RETURN
470 '....instrument error message.......
480 PRINT"Error prompt, status byte = ";STATUS%
490 PRINT
500 RETURN
510 '....I/O error routine..............
520 RESUME
C-2
' append a carriage return
' output the command B$
' read and display response
' if "?" prompt fetch STATUS%
' and display message
' return to start of loop
' enable error trapping
' clear input buffer
' disable error trapping
' LEN(B$) is number of bytes
' send byte
' wait for byte in input buffer
' read input buffer
' input byte should be echo
' next byte to be sent or
' return if no more bytes
' read until prompt received
' append next byte to string
' wait for byte in input buffer
' read byte from buffer
' next byte to be read
' return if it is a prompt
' "ST" is the status command
' output the command
' read response into Z$
' convert to integer
' bits are defined in manual

Advertisement

Table of Contents
loading

Table of Contents