CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Character Table LookUp...

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
NeoMatrix



Joined: 03 May 2005
Posts: 23

View user's profile Send private message

Character Table LookUp...
PostPosted: Wed May 11, 2005 2:17 am     Reply with quote

Hello Everyone

Can anybedy tell me how can i find particular character in the character table

ex: if i write the function like this Display("A") how can i find that character in this character table
Code:

unsigned char const font5x7_1[] = {
0x7E, 0x11, 0x11, 0x11, 0x7E , // A
0x7F, 0x49, 0x49, 0x49, 0x36 , // B
0x3E, 0x41, 0x41, 0x41, 0x22 , // C
0x7F, 0x41, 0x41, 0x22, 0x1C , // D
0x7F, 0x49, 0x49, 0x49, 0x41 , // E
0x7F, 0x09, 0x09, 0x09, 0x01 , // F
0x3E, 0x41, 0x49, 0x49, 0x7A , // G
0x7F, 0x04, 0x08, 0x10, 0x7F , // N
0x3E, 0x41, 0x41, 0x41, 0x3E , // O
0x7F, 0x09, 0x09, 0x09, 0x06 , // P
0x3E, 0x41, 0x51, 0x21, 0x5E , // Q
0x7F, 0x09, 0x19, 0x29, 0x46 , // R
0x46, 0x49, 0x49, 0x49, 0x31 , // S
0x01, 0x01, 0x7F, 0x01, 0x01 , // T
0x3F, 0x40, 0x40, 0x40, 0x3F , // U
0x1F, 0x20, 0x40, 0x20, 0x1F , // V
0x3F, 0x40, 0x38, 0x40, 0x3F , // W
0x63, 0x14, 0x08, 0x14, 0x63 , // X
0x07, 0x08, 0x70, 0x08, 0x07 , // Y
0x61, 0x51, 0x49, 0x45, 0x43 , // Z
0x00, 0x7F, 0x41, 0x41, 0x00 , // [
0x55, 0x2A, 0x55, 0x2A, 0x55 , // 55

0x20, 0x40, 0x44, 0x3D, 0x00 } ; // j




any help is appreciated

Thank You So much

waiting for the reply...
Ttelmah
Guest







PostPosted: Wed May 11, 2005 4:07 am     Reply with quote

The numeric 'index' of the data, will be obtained like:
Code:

void Display(int val) {
   int8 index;
   int8 data;
   int8 ctr;
   index=(val-'A')*5;
   //At this point, 'index' will be pointing at the first array entry for
   //the character matrix. So:
   for (ctr=index;ctr<index+5;ctr++) {
      data=font5x7_1[ctr];
      //output the data as required here
   }
   //Will access the five bytes
}

This will work with the constant string definition, if coded to use an integer, since CCS has a code 'shortcut', tha calls the funtion repeatedly for each byte in the constant string. It will also work with:
Display("This is a test");
With the compiler automatically calling the code for each byte.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group