This is an explanation of the code for the flow control I came up with it to get my Basic Stamp 2(BS2) talking to my Basic Stamp 1(BS1). I am showing the main loops only. For the code files look at letsmakerobots.com and instructables.com. Files or a zip file.
In my code I use a lot of Bit flags. Most processors allow access to the Bits of a Byte or Word to use like regular variables. Basic Stamp 1 and most Picaxe processors have defined variable names for the Bits of first few bytes of memory. Usually it is Bit0 – Bit7 or Bit0 – B15 or Bit0 – Bit31 to define a variable. In both of these processors the variable Bits can also be in another variable. Like my lights Byte B0 the Bits are the variables Bit0 – 7 that are lit1 – lit8 the individual lights. This makes testing of a light easy. “If lit1 = 1 then litOn” is simple.
The Basic Stamp 2 and processors like it use defined subscripting to access the Bits, Nibbles and Bytes of a variable. My individual lights are the variables “lights.Bit0 - Bit7”. In testing a variable Bit is “if lghts.Bit0 = 1 then litOn”. Setting is “litTmp = lights.Bit0”. Usually the subscripts can not be a variable. Look at the program files in the EasyLights article. Read your manual.
I fixed as much as I could. The BS1 doesn’t do serial out very well. It is stable and runs like any simple button on a system like this. The BS1 doesn’t do Bits very well either.
My flow control is the only way I got these systems to communicate.
My text comments will be // in this article. In Basic Stamp code the ' is a comment.