Shop OBEX P1 Docs P2 Docs Learn Events
Stamp to Stamp Serial Communication — Parallax Forums

Stamp to Stamp Serial Communication

Lucas HarlemLucas Harlem Posts: 5
edited 2006-01-09 18:42 in BASIC Stamp
I have two Basic Stamps 2P40's and they are connected to pins 0\1 on the AUXIO,
I am getting erronious data when I try to view the debug screen. This is the wierd stuff that
I see on the debug screen,

Debug Screen Output
þÿþþÿþÿþþÿþÿþþÿþÿþþÿþÿþþ

Here is the code


Stamp 1




Main:
Auxio
Serout 0\1, 16468, [noparse][[/noparse]"Hello"]
Pause 1000
goto main


Stamp 2

MSG Var Byte 'Variable for Message

Main:
Auxio
Serin 0\1, 16468, [noparse][[/noparse]MSG]
pause 1000
Debug MSG

Goto Main

Debug Screen Output
þÿþþÿþÿþþÿþÿþþÿþÿþþÿþÿþþ


Its pretty easy stuff, but I keep getting artifacts on the debug screen instead of the Message Hello. Really wierd looking symbols instead of the letters HELLO. I think it may be the baud rate, I am not very knowlegeable with stamp to stamp serial communications. This is a basic program that I need to adapt to a project I am working on. If I can get the serial comminication to work properly, I can adapt it to my application that I am working on.

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-09 07:40
    Lucas -

    One of the problems is that in the first program, you are transmitting 5 bytes ("Hello") and in the second program, you are only reading one byte (variable MSG defined as one byte). You may want to change the definition of MSG to the following:
    MSG VAR BYTE(5)

    Now when you read it, use SERIN 0\1, 16468, [noparse][[/noparse]STR MSG\5]

    Then when you display it use DEBUG STR MSG\5 .

    Regards,

    Bruce Bates
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-09 15:18
    Two other things to look at.· Make sure your RX pin on one Stamp Module goes to the TX pin on the other and visa-versa.· Also, you should not have a PAUSE 1000 on the receiving side.· It should be ready to receive at any time.· The SERIN will wait until it receives something anyway without a timeout.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-09 15:44
    As Chris points out, make sure that TX on the master is connected to RX on the slave -- check the flow control pins as well. And make sure that Vss is connected betwee the two boards. The PAUSE shouldn't hurt as the program is using flow control (if I'm not mistaken, this is right out of our help file -- and I've run that program and know it does work).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-09 15:56
    Correct, the PAUSE won't hurt anything.· But it isn't doing anything useful.· It's making you wait 1 second after receiving the data to display it on the DEBUG screen, so it doesn't need to be there.· It makes you wait a whole second to see if the byte was received.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-09 16:16
    I think that code came from the help file and the PAUSE is simply there do demonstate how flow control works.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Lucas HarlemLucas Harlem Posts: 5
    edited 2006-01-09 18:42
    Chris, Jon,

    I would like to extend my thanks on this matter I took all of your suggestions and it worked, I had to modify the code, and change the wires around, and add a VSS line between each stamp, no more artifacts Just clear Hello. Thank you so much.

    Respectfully

    Lucas Harlem
Sign In or Register to comment.