3-7
3.7 SAMPLE PROGRAMS
The following program will exercise the scanner relays 1 through 16 and leave both
lines clear. This program is for HPBASIC computers with the scanner address set to 724.
10 ! SCANNER TEST
20 DIM Relay$[32]
30 Relay$=”01020304050607080910111213141516”
40 FOR I = 1 TO 16
50 OUTPUT 724;”A”&Relay$[2*I-1,2*I] ! CLOSES A RELAY
60 WAIT .5
70 OUTPUT 724;”B”&Relay$[2*I-1,2*I] ! CLOSES B RELAY
80 WAIT .5
90 NEXT I
100 OUTPUT 724;”A00” ! CLEARS LINE A
110 WAIT .2
120 OUTPUT 724;”B00” ! CLEARS LINE B
130 END
Note: A Wait of at least 200 milliseconds is required between relay actuations to allow time
for the relay circuits to actuate.
The second program example has exactly the same result as the first program listed above
but uses string output statements. The formatted output statement is used to assure the first
character that the scanner sees (after the address) is the line code and the next two characters are
the relay code.
10 ! SCANNER TEST
30 FOR I = 1 TO 16
40 OUTPUT Code$ USING “A,ZZ”;”A”,I ! SETS CODE
50 OUTPUT 724; Code$ ! CLOSES A RELAY
60 WAIT .5
70 OUTPUT Code$ USING “A,ZZ”;”B”,I ! SETS CODE
80 OUTPUT 724; Code$ ! CLOSES B RELAY
90 WAIT .5
100 NEXT I
110 PRINT “A00” ! CLEARS A RELAY
120 WAIT .2
130 PRINT “B00” ! CLEARS B RELAY
140 END
Summary of Contents for 160A
Page 8: ...1 4 Blank Page ...
Page 10: ...2 2 Blank Page ...
Page 26: ...4 8 Blank Page ...
Page 30: ...5 4 ...
Page 41: ...6 11 ...
Page 43: ...6 13 ...
Page 47: ...6 17 ...