BASIC Stamps are programmed by way of a serial cable. After programming they can be detatched and just run the program downloaded. Another possibility is to use the serial cable to communicate with the computer.

The biggest difficulty is trying to communicate in both dirrections, to and from the stamp.

For me, the solution was to only use half of each byte for data. The other half is used to say whether it the computer is listening or sending data, and eventually it will communicate where the data is supposed to go or come from. Each exchange starts with the computer sending a byte.

The highest bit indicates read/write (0/1), the second what number in the two byte series used to communicate a byte of data. If the byte is marked read, the lower six bits are useless. Otherwise, the lower four bits contain data. The stamp will use the highest two bits to figure out how to respond.

For write instructions, it stores the information and repeats it back. For read instructions, it gathers the neccessary information and sends it to the computer.





Here is a movie of this in action. This particular example has a potentiometer hooked up to the stamp that is used to control the color of the bar on the computer screen. Meanwhile, the location of the bar is outputed on the LCD by the BASIC Stamp.