Program Help: Sending information serially through a pin
Hello,
In my project I have 4 input pins and four output pins. I would like to monitor the state of each pin (high or low) and send that information out to an external interface (such as labview) using only one other pin on the Basic Stamp. This way I do not have to connect a wire to each pin and have 8 wires coming out of the system. It will be clean and only have one connection. Does anybody know how I would be able to program this????
Any help is greatly appreciated!!!
-Ryan
In my project I have 4 input pins and four output pins. I would like to monitor the state of each pin (high or low) and send that information out to an external interface (such as labview) using only one other pin on the Basic Stamp. This way I do not have to connect a wire to each pin and have 8 wires coming out of the system. It will be clean and only have one connection. Does anybody know how I would be able to program this????
Any help is greatly appreciated!!!
-Ryan
Comments
For example, suppose the 4 in and 4 outs were adjacent pins on the Stamp, using p0 through p7.
Your code would be:
x var byte
x = INL
SEROUT outputpin, baudrate, [noparse][[/noparse] x ] ' see SEROUT in the Help file
To send to a "regular" serial device, you could use pin 16 (the program interface). Or, use any other pin and specify the Inverted mode.
Cheers
This is not necessary, but it would save a great deal of wiring. If I accept a string of states serially into a pin how would I be able to distribute the string and match each state up to output pins. For example, I receive a string 0101 and I want that string to tell each output pin in P0-P3 what state to be in. So P0 = 1, P1 = 0, P2 = 1, P3 = 0. I tried looking in all the HELPS and tutorials online and could not find it. Any help would be greatly appreciated.
Thanks,
Ryan
You can address _sequential_ output pins in any of the following grouped manners:
OUTS all output pins
OUTL 0-7 OUTH 8-15
OUTA 0-3 OUTB 4-7 OUTC 8-11 OUTD 12-15
So in your example you would do this:
OUTA = %0101
Hope that gets you started.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->