Author Topic: BS2 Basic serial output code works fine all pins but NOT Pin 1 Sout  (Read 1674 times)

0 Members and 1 Guest are viewing this topic.

Offline K1JOSTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
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
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9892
  • Country: us
Re: BS2 Basic serial output code works fine all pins but NOT Pin 1 Sout
« Reply #1 on: February 04, 2017, 11:36:43 pm »
Sin and Sout have a form of level shifting for connection to actual RS232 levels, not TTL levels.  Not only are the voltages different, the signals are inverted.

https://www.parallax.com/sites/default/files/downloads/BS2-IC-Schematic-Rev-J_0.pdf
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 828
Re: BS2 Basic serial output code works fine all pins but NOT Pin 1 Sout
« Reply #2 on: February 05, 2017, 12:35:25 am »
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.
 

Offline K1JOSTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Re: BS2 Basic serial output code works fine all pins but NOT Pin 1 Sout
« Reply #3 on: February 05, 2017, 12:40:34 am »
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
 

Offline K1JOSTopic starter

  • Regular Contributor
  • *
  • Posts: 137
  • Country: us
Re: BS2 Basic serial output code works fine all pins but NOT Pin 1 Sout
« Reply #4 on: February 05, 2017, 12:51:04 am »
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
 

Online cv007

  • Frequent Contributor
  • **
  • Posts: 828
Re: BS2 Basic serial output code works fine all pins but NOT Pin 1 Sout
« Reply #5 on: February 05, 2017, 12:56:25 am »
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.

Quote
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.

« Last Edit: February 05, 2017, 12:59:23 am by cv007 »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf