Software Serial Driving me mad.

First of i want to thank you guys for being there, Lurkers like me get alot of help by reading through the archives.

Second,
I have a Serial device with a built in ping feature. If i send "A" in Ascii I should receive back "4" in Ascii So i wrote a little program to test this using the Usual softSerial Library. I had nothing but problems. Receiving garbage data back every time.
Sending Data seems to work, but receiving is another story. Oh well. So i Cruz the forums a bit and stumble upon Lady Adas Software library. The difference i can see is it uses a hardware interrupt to trigger a buffer catching the data. You then Pull the data out of that buffer at your leisure. Sweeeeet. So i write the following Sketch to test:

#include <AFSoftSerial.h>
AFSoftSerial AD4Serial =  AFSoftSerial(3, 2);
void setup()  
{
  pinMode(13, OUTPUT);
  //pinMode(3, OUTPUT);
  //digitalWrite(3, HIGH);
  //^^ Tried setting TX pin High to see if it would make a difference. It dident.
  Serial.begin(9600);
  Serial.println();
  AD4Serial.begin(9600);
  Serial.println();
  Serial.println("=======Lets Begin======");
}
void loop()
{
  delay(100);   //So things dont get to crazy
  AD4Serial.print(0x41, BYTE); //Sending an Ascii "A", Should return Ascii "4" Sending Ascii directly fails. I dont know why.
  if (AD4Serial.available()) 
  {
    Serial.print("|");
    Serial.print(AD4Serial.read());
  }
  digitalWrite(13, HIGH);
  delay(100);
  digitalWrite(13, LOW);
  pulse();
}

void pulse()
{
  //Sanity Check
  digitalWrite(13, HIGH);
  delay(50);
  digitalWrite(13, LOW);
}

I run my sketch and i receive this back in the term.

=======Lets Begin======
|32|35239052|2|52|{2|416074956952|52|?2|422785843252|í

The (52) I see tells me that some of my data is getting back to me, Alot of garbage is too tho. Also "Lets begin" is telling me the amtel is crashing/restarting. I'm guessing this is because i'm over filling the Int.
The Amte644 with with Dual USART Goodness is looking pretty good right now. i just hate to be defeated .

Mussen,

Do you get the "let's begin" message repeatedly, or only once? We would expect to see it once, because the Arduino (Diecimila) resets automatically when a serial connection is made.

If I were debugging this, I would try temporily simplifying the code so that it transmitted only a single "A". This might make it easier to detect a pattern in the data that's printed.

Mikal

I would get the "Lets Begin" every few seconds. I dident post all the trash it left me because one of the ASCII codes was breaking The forum. Guess the input scrubber isent doing its job.

I updated my code as follows:

Im posting it as an image, something new and strange is going on. every time i paste this in it Stops the post and cuts off everything after. my code...

Notice That the Second "e" in seem is missing I changed the string around a bit and every time the letter in that space is missing... ok...

Serial.println("123456789");
Returns "1

This doesn't resolve the main issue, but your loop code doesn't blink anything. You need another delay:

digitalWrite(13, HIGH);
delay(350);
digitalWrite(13, LOW);
delay(350);

The check for AD4Serial.available() happens immediately after you sent the byte. That's way too fast to expect the returned character to have arrived. You should wait for the returned character(s) by adding a delay, or better yet, adding a while (true) loop around the if/else clause so that it repeatedly checks for characters. Is that clear?

Mikal