Hi,
Have a look http://66.13.172.18/techref/microchi...adix/index.htm
Hi,
Have a look http://66.13.172.18/techref/microchi...adix/index.htm
Regards
Sougata
I don't know if it is elegant but ...
X var WORD
Y var BYTE
NumArray var BYTE[4]
X = 63251
Y = X.lowbyte & $0F ' isolate the lower nibble
gosub ConvertAscii
NumArray[3]=Y ' ="3"
Y = X.lowbyte >> 4 ' move high nibble to low nibble
gosub ConvertAscii
NumArray[2]=Y '="1"
Y = X.highbyte & $0F ' isolate the lower nibble
gosub ConvertAscii
NumArray[1]=Y '="7"
Y = X.highbyte >> 4 ' move high nibble to low nibble
gosub ConvertAscii
NumArray[0]=Y '="F"
END
ConvertAscii:
If Y < 10 then
Y = Y + 48
Else
Y = Y + 55
Endif
Return
Good Luck,
Paul Borgmeier
Salt Lake City, Utah
USA
Last edited by paul borgmeier; - 16th April 2006 at 07:54.
After I posted I realized that I had the answer all along. I wrote an Intel Hex routine awhile back. It dealt with bytes only. All I had to do was to use the routine twice - very similar to your approach.
Thanks for responding!
Charles Linquist
Bookmarks