??? 12/19/08 01:51 Read: times |
#161043 - Looking for a fast elegant solution to an SAA1064 |
I'm working on a project that uses these devices. Since they don't conform to ASCII generation and only bit patterns for a 7 segment display, I'd like to construct a code array that can do a fast look up.
I'll have a counter from 0000 to 9999 that repeats, so the count will be in hex but the display will need decimal conversion (easy), but the number then must be parsed digit by digit and then compared against the array and then displayed on the seven segment display. I've already done the leg work of the testing, but since I want to also consider an alphanumberic in the future (for phrases), I'm trying to find and easy way to do a "lookup" from 0-9 and A to Z. Since it is in a non ascii table format for the lookup, I want to avoid long extensive "if" comparisons which will just chew up mips. Is there a simple solution that I could look at? Here is the legwork and patterns of the device: 00000001 = A 00000010 = B 00000100 = C 00001000 = D 00010000 = E 00100000 = F 01000000 = G 10000000 = DP Bit pattern for number 1 = 00000110 = 0x06h Bit pattern for number 2 = 00000110 = 0x5Bh Bit pattern for number 3 = 01001111 = 0x4Fh Bit pattern for number A = 01110111 = 0x77h Bit pattern for number b = 01111100 = 0x7Ch I just contructed this simple array based on the 5 pieces above. uchar DisplayLookup[] = {0x06, 0x5B, 0x4F, 0x77, 0x7C}; 1A23h = 6691d should be displayed on the devices. Any thoughts on the best approach? Thanks |
Topic | Author | Date |
Looking for a fast elegant solution to an SAA1064 | 01/01/70 00:00 | |
several ways | 01/01/70 00:00 | |
Simple Table Lookup | 01/01/70 00:00 | |
Constructing the table symbolically | 01/01/70 00:00 | |
That looks like it will do the trick | 01/01/70 00:00 | |
Ok I'm here now....... | 01/01/70 00:00 | |
first convert to decimal, then to ASCII | 01/01/70 00:00 | |
So... | 01/01/70 00:00 | |
Keep track of binary/BCD/hex/ASCII | 01/01/70 00:00 | |
Final answer and it works | 01/01/70 00:00 | |
But '0' - 0x30 is zero :)![]() | 01/01/70 00:00 | |
not exactly | 01/01/70 00:00 |