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
Bookmarks