December 30, 2001
Now we're getting somewhere. The LCD works and the routines are pretty set. Now to do what at first seems impossible, convert a 16 bit number into ASCII text. It shouldn't be that hard. Of course, there isn't a divide instruction.
Lack of divide makes it more difficult but we can do it the old fashioned way, subtracting :-). This project actually helped in a couple of ways, one it let me re-use some Z80 code from back in the day, and two it gave me an opportunity to check out the macro language in MPASM 5.x.
This project simply displays the contents of a counter on the LCD with the text
Count: 00023
As you can see its pretty basic, no leading zero suppression etc. The BIN2ASCII macro takes about 75 program words (its all "unrolled") and has a worst case run time of 360 cycles when decoding 59999, best case is 84 cycles decoding 0.
(Back to the projects Page)