11 years, 8 months ago.

Convert Char to float for RS485 addressing

Hello All, Im quite new to this and I think this is a simple question. I am Using Richard Ellingworth excellent RS485 test bed and I have two mbeds communicating the alphabet to each other using the Max485 chips.

My question is I am sending and receiving a char but need to use somthing like an int or float to address the devices. eg: if mbedaddress=01 then respond else ignore.

Can I address using a char or do I need to convert or transmit and int or float.

Any help most welcome

John

1 Answer

11 years, 8 months ago.

To the microprocessor a char is just an 8 bit int so you can use it as if it were a number. The only thing that makes it a character is how you choose to interpret it, in your case using ASCII format.

Tim