Convert and transmit

Thread Starter

allcircuit

Joined Jan 7, 2009
31
Wow....it 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:

Rich (BB code):
calc_Ah:
    add1632    Amps,AmpSum    ; AmpSum = accumulated Amps
    mov32    AmpSum,dd
    movi16    3600*3,aa    ; 3 reads per second, 3600 seconds per hour
    call    Div32        ; AmpHours = AmpSum  / (reads per hour)
store_Ah:
    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..
 

TC Blake

Joined Apr 26, 2008
2
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?
 
Top