I need to send a basic stamp data stream (one direction) to a PIC device (fixed at 2400, 8N1, true polarity). I need all BS2 digital pins P0-P15 for my project so would like to use physical pin1 (Sout). 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 the code works fine if I change SEROUT to any other pin P0-P15.
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
Try setting SEROUT to inverted (for normal output), depending on how smart the firmware is.
Looks like possibly very weak pulldown through the Sin npn pack, but maybe tie Sin to ground so it is used as a stronger pulldown for Sout through the 4.7k.
Just a thought.
Thanks all for taking time to reply. Can you clarify a bit more? If just higher voltage and inverted why can't I decode it on my scope? Also the TX (pin8) on the BS2 is only going to a single 2N3906 before terminating at Sout so other than inverting no much change on the voltage I guess.
The device I am trying to modify has a BS2 sending a data stream to a PIC16F54 directly from Sout to a small voltage divider (220K/(220k+22K)) to the PIC16F54 RA0 pin. If the only difference between using a BS2 pin or using Sout is signal inversion then I should be able to just direct the BS2 to use inverted polarity but that didnt work either.
Any other advice ... I hope :-)
Jerry
OK I am an old idiot... I am learning to use my new digital scope and I fofgot to readjust my trigger, now decoding fine.
So now I think I need to go back over my steps and see if just inverting the serial port will do the trick
thanks again.
Jerry
There is no level shifting as Sin is not used, you are transmitting using the stamp power.
Check the tx pin directly first (with the scope), so you know whether normal or inverted is needed (maybe firmware is smart, or maybe not). If normal looks correct, you need inverted, if inverted looks correct, you need normal. If you can't decode output from tx, then anything else further down the circuit will not matter.
It looks like Sout will be pulled down to Vss through a pair of 10k's in the npn pack, then 4.7k to the Sout pin- to make it stronger tie Sin to Vss.
OK I am an old idiot
You are using a Basic Stamp, you may be old. You can't be an idiot if you found this forum.