0

When I am using RF 433 MHz module with ARDUINO MEGA then it is transmitting any text or anything in ASCII values. Now how to decode those ASCII values to alphabets? If I use ASCII conversion programme then what if I send a number and that conversion program converts that number also to text or related ASCII character? please suggest any way.

1
  • Nothing gets "converted" - ASCII values and text are one and the same thing. It's all down to how you print it.
    – Majenko
    Aug 1, 2016 at 10:33

1 Answer 1

2

Lokesh, to expand on what Majenko said when you transmit something over this sort of link you are transmitting either a 1 or a 0. When 8 ones or zeros arrive you have a byte. A byte has a value of between 0 and 255 and what this means is entirely up to the 'protocol' you are using.

In your case your sending program is sending a letter, lets say A. Now the A that you are sending is held in memory as a byte with the value of 65, 65 is the ASCII [code] for A. So 65 is sent as 8 different transmissions to the other end of the link and is received, built back into a byte and your program receives a byte with the value of 65. Your receiver program is using the same protocol as your transmitter program, so it 'knows' you don't meant the number 65, the colour green or an elephant riding a bicycle, you mean the character A.

To show that A you might need to cast the data you receive to a character i.e.

unsigned char rxData = 0;
Radio.ReceiveData (&rxData, 1);
Serial.println((char)rxData);
1
  • 2
    An elephant riding a bicycle is 64, not 65.
    – Majenko
    Aug 1, 2016 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.