PDA

View Full Version : Stamp to Stamp Serial Communication



Lucas Harlem
01-09-2006, 02:46 PM
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, ["Hello"]
Pause 1000
goto main


Stamp 2

MSG Var Byte 'Variable for Message

Main:
Auxio
Serin 0\1, 16468, [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.

Bruce Bates
01-09-2006, 03:40 PM
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, [STR MSG\5]

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

Regards,

Bruce Bates

Chris Savage
01-09-2006, 11:18 PM
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 (mailto:csavage@parallax.com)

Jon Williams
01-09-2006, 11:44 PM
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 Savage
01-09-2006, 11:56 PM
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 (mailto:csavage@parallax.com)

Jon Williams
01-10-2006, 12:16 AM
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 Harlem
01-10-2006, 02:42 AM
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