|
The second program is more complex as it makes use of Boolean logic to isolate certain bits in the single byte received in downbyte.
First I’ll show the Stamp 2 program, and then the VB6 program.
NB: The same MSComm property settings are used in this program as well.
In this case the VB6 program sends a single byte in which bits 0, 1, 2 denote the address of the LED to switch on or off, and bit 3 denotes whether to switch it on or off.
That is, I am now using only 4 bits of the download byte to achieve the same effect as in the first program. I still have 4 bits spare to do other things should I so wish.
The Stamp 2 program receives the byte, then uses Boolean AND (written & in Stamp World) to isolate the bits and react to them.
|