View Full Version : eb500 communication between BASIC Stamps

03-05-2005, 01:09 AM
Hi all, I'm looking for help on using the Embedded Blue eb500 module to communicate between two BS2 chips.· I have been working through some examples from the handbook, and I can get either chip to connect to the other just fine.· However, when I try and send data, it appears as though there are a few serial communication problems - the receiver should (via the debug terminal on the host pc)·display "Hello World" 10 times, but actually displays, for example, "HëolHerĝHerĝHerĝHerĝHerĝHerlHerlHerdHerĝ"
with no carriage return in between.· I put in flow control (or tried to) in both hard wires and code, but this has made no difference.· In the Stamp help sheet, it says "* The BASIC Stamp 2sx and BASIC Stamp 2p may have trouble synchronizing with the incoming serial stream at this rate and higher due to the lack of a hardware input buffer. Use only simple variables and no formatters to try to solve this problem."· Is this the problem?· The eb500 module appears to only communicate down to a baud rate of 9600, so I cannot reduce the rate to give the Stamp a little more chance to catch up.

The intended solution is to have an input on one Stamp chip controlling outputs on another - I am developing a useable interface for people of all disablities to control a Bluetooth enabled system, letting them have greater control over the external environment such as lifts, doors, lighting and so on.· This is a prototype for an honours year university project, in Innovative Product Design at Dundee University, Scotland.

I have attached my code for both parts and my circuit diagram - both halves of the circuit are the same apart from the input switch, which is not included on the receiver.

Any help with this or any tips would be greatly appreciated!!


Stephen Swanson (Parallax)
03-05-2005, 06:15 AM
··········· In your receive code you will want to set up the string array to bring whole data string at once.
So the lines:
bData············ VAR ·Word·
SERIN InputLine\FlowControlIn,SerialCode,[STR bData\1]

Please try:
bData············ VAR byte( 11)

SERIN InputLine\FlowControlIn,SerialCode,[STR bData\11]

Stephen Swanson
Technical Support
Parallax, Inc.
sswanson@parallax.com (http://www.americaneconomicalert.org/ticker_home.asp)
[url=http://www.parallax.com/] (http://www.parallax.com)

03-05-2005, 06:43 PM
It works!!·http://forums.parallax.com/images/smilies/tongue.gif http://forums.parallax.com/images/smilies/tongue.gif· Thank you very much, I just couldn't see where it was going wrong!· I'm still quite new to serial communication and using byte arrays (+ strings of same).·

Is there a limit to the number of sections of an array - ie how much bigger than 11 can I go with this?·

Thanks for your help.

03-06-2005, 01:07 AM
I believe you are allowed 10, anything more and you will access the next RAM location past the end of the array and can cause all kinds of bugs.


Dave Andreae

Tech Support
dandreae@parallax.com (mailto:dandreae@parallax.com)
www.parallax.com (http://www.parallax.com)


Bruce Bates
03-06-2005, 02:11 AM
Ed -

Your question regarding arrays has two answers. The actual answer to your question about the maximum size of an array is determind by the amount of varable space available on the Basic Stamp in question. The following comes directly from the Stamp PBASIC Manual:

"All 24-pin BS2 models have 32 bytes of Variable RAM space. Of these, the first six bytes are reserved for input, output, and direction control of the I/O pins. The remaining 26 bytes are available for general-purpose use as variables."

Thus, if there were no other variables defined in a program, the following would be a legitimate allocation:

array var byte(26) 'Assign maximum array size

In the real world you would probably have other variables defined, so those must be subtracted from the 26 bytes available to determine, on an individual program basis, how large an array is possible for that program. If you exceed the amount of available storage, the Stamp Editor will flag it as an error. The Stamp Editor will NOT flag an out of bounds array subscript however.


Bruce Bates