Convert and transmit

Discussion in 'Embedded Systems and Microcontrollers' started by allcircuit, Apr 8, 2009.

  1. allcircuit

    Thread Starter Active Member

    Jan 7, 2009
    0 took me whole day to settle my configurations for the pins. Now what i need to do is having UART over pre-built hardware UART on RB5 of 16F88. I am now having a variable called AmpHour which is stored as this:

    Code ( (Unknown Language)):
    1. calc_Ah:
    2.     add1632    Amps,AmpSum    ; AmpSum = accumulated Amps
    3.     mov32    AmpSum,dd
    4.     movi16    3600*3,aa    ; 3 reads per second, 3600 seconds per hour
    5.     call    Div32        ; AmpHours = AmpSum  / (reads per hour)
    6. store_Ah:
    7.     mov16    dd+2,AmpHours
    It is a 16 bits binary. I need to convert it to human readable ASCII and send it using UART. Huh....learning by the way..
  2. TC Blake

    New Member

    Apr 26, 2008
    Simple questions to get out of the way:

    Do you mean that the 16-bit value should represent 2 ASCII characters? What human-readable format do you need? Hex, decimal, or text? If the displayed string is numeric, you can get characters by simply adding '0' (with quotes) to an 8-bit value. Please elaborate.

    There's an argument to be made that sending the raw binary allows you to customize the conversions within different receivers. Is that feasible in your case?