BASIC stamp manual v2.2
5: BASIC Stamp Command Reference – PUT
BASIC Stamp Syntax and Reference Manual 2.2 • www.parallax.com • Page 353
DEBUG "Program Slot #", DEC value.NIB0, CR
Main:
FOR idx = 0 TO 9
value = (idx + 3) * 8
PUT idx, value
DEBUG " Writing: ", DEC2 value, " to location: ", DEC2 idx, CR
NEXT
DEBUG CR
RUN 1
END
Demo Program (GET_PUT2.bsx)
' GET_PUT2.bsx
' This example demonstrates the use of the GET and PUT commands. First,
' the Slot location is read using GET to display the currently running
' program number. Then a set of values are read (GET) from locations
' 0 to 9 and displayed on the screen for verification. This program is a
' BS2SX project consisting of GET_PUT1.BSX and GET_PUT2.BSX, but will run
' on the BS2e, BS2p, BS2pe, and BS2px without modification.
' {$STAMP BS2sx}
' {$PBASIC 2.5}
#SELECT $STAMP
#CASE BS2
#ERROR "BS2e or greater required."
#CASE BS2E, BS2SX
Slot CON 63
#CASE BS2P, BS2PE, BS2PX
Slot CON 127
#ENDSELECT
value VAR Byte
idx VAR Byte
Setup:
GET Slot, value
DEBUG "Program Slot #", DEC value.NIB0, CR
Main:
FOR idx = 0 TO 9
GET idx, value
DEBUG " Reading: ", DEC2 value, " from location: ", DEC2 idx, CR
NEXT
END
NOTE: This is written for the BS2sx but
can be used with the BS2e, BS2p,
BS2pe, and BS2px also. This program
uses conditional compilation
techniques; see Chapter 3 for more
information.