Serial transmission of floating point over RS232???

Discussion in 'Embedded Systems and Microcontrollers' started by sairyuva, Apr 15, 2010.

  1. sairyuva

    Thread Starter New Member

    Mar 9, 2010
    11
    0
    Can any one give me a hint to send floating point over RS232 in PIC16f877a???
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    You just transfer the floating point as separate bytes. But beware of endinness
    http://en.wikipedia.org/wiki/Endianness
    Can give us some more details. Like which language you program your PIC in etc.
    By the way, you use TTL to RS232 level converter on the PIC side?
     
  3. sairyuva

    Thread Starter New Member

    Mar 9, 2010
    11
    0
    i am using hictech c compiler in mplab
     
  4. rjenkins

    AAC Fanatic!

    Nov 6, 2005
    1,015
    69
    Different systems and compilers use different internal storage formats for floating point values.

    The simplest way is send it as a text number.

    eg. use sprintf to convert it to an ascii text string with formatting for the correct number of significant digits, then send that string a character at a time.

    You could add some simple framing data to make it easier to track at the receiving end, like sending '#' first and ':' after, and a new line \n.

    That makes is easy to check in hyperterminal or whatever as it's readable, and it's very obvious to your software when one string of digits ends and the next starts.
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    In order to give you more help. You have to tell us what you have done so far. Also why and how you struggle. This will take very long time if we have to drag every bit of information out of you.
     
Loading...