Shop OBEX P1 Docs P2 Docs Learn Events
Is there any difference between serout 16 and serout 0- 15? — Parallax Forums

Is there any difference between serout 16 and serout 0- 15?

ZelZel Posts: 5
edited 2008-01-08 06:03 in BASIC Stamp
Hi Guys

Currently I am using a BS2P40 for my school project, I have tested using physical pin 5 (p0) on mainio side as a serin pin, connected to a serial interface, I used a direct connection, with no resistor or whatsoever in between the two end points. I could get the correct default bits sent by the serial interface to the BS by using debug to see the data sent.·But when I try to use the dedicated physical pin 2 as serin pin, I could not get the correct default bits sent by the serial interface, (I·have an LCD screen to display the value too, as I cannot use debug to see the data sent to BS·as Physical pin 2 is used for serial interface)·there is also no other components in between the 2 points. 1 point is that,·in my circuit, the·physical pin 2 is also connected to the compiler as it is a requirement when downloading program. But I did plug out the compiler when I let the serial interface send data to physical pin 2.
Following are my code for that part. I have changed only the number "0" to "16" in the command.

SERIN 16, T9600, [noparse][[/noparse]STR letter\3]··
'SERIN 0, T9600, [noparse][[/noparse]STR letter\3]

I am wondering if there if any configuration or wiring difference when using dedicated serin pin and normal I/O pins as serin pin.

I have also attached the part of the·schematic that I am having problem with. Please have a look at it, Thank you.

·

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2008-01-07 13:07
    Zel,

    The two cases are similar, but different in that pin 16 has additional hardware to use "real" RS-232 voltage levels. Using pins 0 - 15 uses 5 volt logic levels. As well, the pin 16 hardware introduces an inversion in the signal logic.

    So, if you're talking stamp to stamp, pins 0 - 15 will work fine. If you're talking to another device which uses standard serial levels use pin 16. Note that you should always use the 9-pin programming connector of whatever board you have the Stamp plugged into.

    A common problem with serial communication is to have the Tx and Rx at one end connected to Tx and Rx at the other end because there are variations in how manufacturers assign pin 2 and 3 of the 9-pin connector. You may have to swap Tx, Rx at one end.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • steve_bsteve_b Posts: 1,563
    edited 2008-01-07 13:43
    And don't forget to tie the grounds together. Your "Interface Picture.doc" file shows a schematic, but not what you actually did.

    When I work with RS232, I'm almost always getting Tx and Rx backwards....so in troubleshooting, I swap them to see if that fixes it.
    If I'm working with a stamp, I'll go with a TRUE baudmode value and then try the inverted version....I'm sure with a little thought, on my end, I could avoid this, but I'm not too worried by comm signals being backwards....power supply lines; i spend a LOT more time making sure I get right!

    Cheers

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <FONT>Steve



    What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
    Lee Travino after the second time being hit by lightning!
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-01-07 14:45
    Bottom line -- yes, they're different.

    "SEROUT 16" uses the "16" as a pseudo-pin, which indicates "use the programming port pins as a serial port".

    "SEROUT 0" to "SEROUT 15" indicates "use the I/O port pin indicated as a serial port".
  • ZelZel Posts: 5
    edited 2008-01-08 06:03
    Hi Guys,

    Thanks for all your help and time, I have done further testing and discovered another problem, I have added a new post "Dedicated·serial pin to dedicated serial pin only·only?", please have a look at it, Thanks.
Sign In or Register to comment.