Shop OBEX P1 Docs P2 Docs Learn Events
serial port — Parallax Forums

serial port

soyyamsoyyam Posts: 3
edited 2005-07-22 21:19 in BASIC Stamp
if i wanted to connect the bs2p40 to a video overlay device using a serial cable which pins would i need to use?· Sout and Sin only work connecting to the computer?

thanks

Comments

  • YanroyYanroy Posts: 96
    edited 2005-07-20 20:14
    If you use SERIN and SEROUT, you can use SIN and SOUT on any pin(s) 0 through 15.· If you want to use SIN and SOUT, you can specify 16 as the pin.· Then you can use the same serial port on the stamp that you would normally use for programming - keep in mind that doing this can make debugging difficult, since it will conflict with DEBUG statements.
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2005-07-20 20:41
    Gents -

    One other caveat about using SERIN/SEROUT to pin port 16. I stand to be corrected, but as I remember, the BAUDMODE is LOCKED IN to that of DEBUG (9600, 8, N, 1). Said differently BAUDMODE will be ignored if pin port 16 is used. This is a somewhat hidden aspect of using it, and thus why I mention it. It may not be a problem however, depending on the application.

    Regards,

    Bruce Bates
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-07-20 20:43
    Umm, I don't think so.

    If you SEROUT 16, <somebaudmode>, [noparse][[/noparse]"Hi",13]

    Then "Hi" will come out at the baud rate selected by the baud mode value.

    However, you DO have to have a 'real' RS-232 driver connected to the RX line, so the TX line can use that to modulate itself.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-20 21:18
    You can use the programming port (pin 16) at any baud the BASIC Stamp is capable of; DEBUG and DEBUGIN work at 9600 (19.2k on the BS2px), but SERIN and SEROUT can use any supported rate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-07-20 22:13
    allanlane5 said...(trimmed)
    Umm, I don't think so.
    If you SEROUT 16, <somebaudmode>, [noparse][[/noparse]"Hi",13]
    Then "Hi" will come out at the baud rate selected by the baud mode value.
    However, you DO have to have a 'real' RS-232 driver connected to the RX line, so the TX line can use that to modulate itself.
    Allan,

    ·· I'm not sure if we're all on the same page, but just to be sure, yes you can set the baud rate to any baud rate that can be used on any other pin, but as for Baud Modes, please note the following text from the PBASIC Help file:

    "If the dedicated serial port (Tpin = 16) is used the data is inverted and driven regardless of the baudmode setting."


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-07-21 00:50
    Yes, but the point the other guy was making was that SEROUT on pin 16 ONLY ran at 9600 baud -- which is incorrect.

    And my understanding matches yours, that no matter what the "inverted/not inverted" bit is set to, or the "open/not open" baud mode bit, on pin 16 the result is Inverted, Not Open (in other words, matching what a PC expects to see).
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-07-21 02:15
    Allan,

    ·· Okay, we are on the same page...Sometimes I get lost in the different views on something, and am not sure who's thinking what.· LOL· =)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Andrew MacAndrew Mac Posts: 4
    edited 2005-07-22 20:19
    i have a related question. i had a program using SERIN 16, b24, ... (where b24 was the code for 2400,8,N,1)

    it worked fine using both

    1) a BOE, USB, BS2

    and

    2) standard serial (COM1) connection to a Homework board.

    Then I tried running it on a BS2p40 connected via USB to the Professional Development Board, and I can't get it to work.

    Any suggestions for debugging, or arcane secrets I should know?

    TIA.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-07-22 20:22
    Andrew,

    ·· Since you used the Homework Board (BS2-based) before, and the BOE with a BS2, I am going to assume you're using the same code on the BS2p40.· In this case you probably are using the same baud rate parameters, which between the BS2 and BS2p40 are different.· It would help if you posted your code.· It would also generate more replies to post a new thread in the future.· This one was already taken care of and many people probably wouldn't notice your post.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Andrew MacAndrew Mac Posts: 4
    edited 2005-07-22 21:19
    Brilliant! That was the "secret" (it's right there in the manual, of course!): changing 396 to 1021. Thanks!
Sign In or Register to comment.