Arduino shows difference between Serial input and Echo back

Hi There, I understand ( I think) that the serial port on the Arduino (UNO in my case) reads and writes in ASCII.

So when I have this in a loop :

//Read Buffer
  if (Serial.available() > 0) 
  {
      inputByte = Serial.read();
      Serial.print(inputByte);    
  }

I expect to get back the ASCII character I send from my .NET serial comms application.

But I don't. Up to ASCII 127 (the end of Standard ASCII) I get the ASCII echoed back at me. However, above 127 I get back 63 which is ASCII for ?

BUT I can do this in a sketch:

 //Set LED state
  if(inputByte == 255)
  {
      digitalWrite(ledPin, HIGH);
  }

And it works fine, so the 255 is detected.

What's going on? Can the Arduino read to 255 but not send above 127?

Any comments to illuminate would be great.

Thanks Richard

What's going on? Can the Arduino read to 255 but not send above 127?

You're barking up the wrong tree. The problem is on the .Net side. Something, on the PC, between the hardware and your application is performing "character translation" (or "code page translation" or whatever term the folks at Microsoft are using this week). I vaguely recall this problem has been discussed previously on the forum.

Have you tried using Serial.print(inputByte, BYTE); ?

Lefty

I vaguely recall this problem has been discussed previously on the forum.

It has been, and Coding Badly is right. The problem is your PC application.

Looks like you are right.

I downloaded a port monitor and I can see the correct data coming back.

Odd. Luckily the echo was just for debugging so it doesn't matter too much.

Thanks for the advice. R