Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/05/03 03:47
Read: times


 
#50097 - 5x7 character mapping
I have a Thermal printer with a 5x7 dot interface. I'd like to efficiently map ASCII 20h-7Eh such that I don't use too much code. I'm using a later version of Keil C for the code. I'd like my "application layer" to work fairly similar to your typical printf type call. For example:
PrintLine("Hello Worldn");

I fully understand how to bit-twiddle the printer and am just looking for some ideas about how to implement the character map table efficently. I'm aiming for smaller code size as opposed to speed. Although I hope it's somewhat speedy.

My initial thinking was to declare the data like:

char code P_3[] = {0x42,0x82,0x8A,0x96,0x62}; // '3'
char code P_4[] = {0x30,0x28,0x24,0xFE,0x20}; // '4'
etc, etc

*** note the least sig bit is unused and set to 0 ***

As such it would be accessed by way of pointer arithmatic I guess. For example, to get to ASCII 3 start of data:

char* ascii_table;
int i, x;

ascii_table = 0x20;
x = 0x33-0x20; // 'a' - ' '
for(i=0;i<x;i++)
ascii_table +=5;


I'm probably reinventing a nasty wheel with some pretty poor code. Any better solution? Maybe using multi-dimension?

TIA
Mark D



List of 14 messages in thread
TopicAuthorDate
5x7 character mapping            01/01/70 00:00      
   RE: 5x7 character mapping            01/01/70 00:00      
   RE: 5x7 character mapping            01/01/70 00:00      
   RE: 5x7 character mapping            01/01/70 00:00      
      RE: 5x7 character mapping            01/01/70 00:00      
   RE: 5x7 character mapping            01/01/70 00:00      
      RE: 5x7 character mapping            01/01/70 00:00      
         RE: 5x7 character mapping            01/01/70 00:00      
            RE: 5x7 character mapping            01/01/70 00:00      
            RE: 5x7 character mapping            01/01/70 00:00      
               RE: 5x7 character mapping            01/01/70 00:00      
            RE: 5x7 character mapping            01/01/70 00:00      
               RE: 5x7 character mapping            01/01/70 00:00      
                  RE: 5x7 character mapping            01/01/70 00:00      

Back to Subject List