BS2 simple serial out works with any pin but not Pin1 - Sout
NY2KW
Posts: 3
in BASIC Stamp
I need all digital pins P0-P15 for my project. I also need to send a data stream (one direction) to a PIC device. I am using the following basic code to send a test stream. The PIC expects True polarity not inverted:
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM12}
Main:
DO
SEROUT 16, 396, ["Hello!", CR] ' send the greeting
PAUSE 100 ' wait 0.1 seconds
LOOP ' repeat forever
END
It doesn't work on Pin 1 however it works fine if I change SEROUT to any other pin.
Just to be sure I looked at the Pin output on my scope which has a UART logic decoder and its all gibberish regardless of settings I try. With the BS2 set for any pin 0-15, the code works perfectly and my scope easily decodes.
Would the line driver on Pin Sout be affecting this? The only wires I have from BS2 to PIC (or scope) are the Sout and Ground.
Any advice appreciated.
Jerry NY2KW
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM12}
Main:
DO
SEROUT 16, 396, ["Hello!", CR] ' send the greeting
PAUSE 100 ' wait 0.1 seconds
LOOP ' repeat forever
END
It doesn't work on Pin 1 however it works fine if I change SEROUT to any other pin.
Just to be sure I looked at the Pin output on my scope which has a UART logic decoder and its all gibberish regardless of settings I try. With the BS2 set for any pin 0-15, the code works perfectly and my scope easily decodes.
Would the line driver on Pin Sout be affecting this? The only wires I have from BS2 to PIC (or scope) are the Sout and Ground.
Any advice appreciated.
Jerry NY2KW
Comments
-Phil
SEROUT 16, 396, [string]
or
SEROUT 16, 16780, [string].
My scope to decode does not automatically find the right polarity - i have to set it and I leave it unchanged with both 396 or 16780 and the signal burst is identical.
Any suggestions?
TIA
Jerry
-Phil
Another peculiarity of the Stamp wiring is that the collector of that PNP transistor is connected both to pin 1 of the module, SOUT, and to a 4.7kohm resistor that goes to the SIN pin. The idea is that SOUT will "steal" negative or zero voltage from the SIN pin. If SIN is floating, there is still a path to ground via a pair of 10k resistors and the base of the NPN transistor that inverts the SIN signal. You can see the schematics in the appendix of the Stamp manual.