|
|
View previous topic :: View next topic |
Author |
Message |
MegatroniC
Joined: 08 Dec 2009 Posts: 35
|
degrees symbol |
Posted: Tue Feb 14, 2012 8:56 am |
|
|
Hello,
Please help me,
how to create insert into the array (GRAPHICS.C, FONT array) degrees symbol?
Code: | const unsigned int8 FONT[51][5] ={0x00, 0x00, 0x00, 0x00, 0x00, // SPACE
0x00, 0x00, 0x5F, 0x00, 0x00, // !
0x00, 0x03, 0x00, 0x03, 0x00, // "
0x14, 0x3E, 0x14, 0x3E, 0x14, // #
0x24, 0x2A, 0x7F, 0x2A, 0x12, // $
0x43, 0x33, 0x08, 0x66, 0x61, // %
0x36, 0x49, 0x55, 0x22, 0x50, // &
0x00, 0x05, 0x03, 0x00, 0x00, // '
0x00, 0x1C, 0x22, 0x41, 0x00, // (
0x00, 0x41, 0x22, 0x1C, 0x00, // )
0x14, 0x08, 0x3E, 0x08, 0x14, // *
0x08, 0x08, 0x3E, 0x08, 0x08, // +
0x00, 0x50, 0x30, 0x00, 0x00, // ,
0x08, 0x08, 0x08, 0x08, 0x08, // -
0x00, 0x60, 0x60, 0x00, 0x00, // .
0x20, 0x10, 0x08, 0x04, 0x02, // /
0x3E, 0x51, 0x49, 0x45, 0x3E, // 0
0x00, 0x04, 0x02, 0x7F, 0x00, // 1
0x42, 0x61, 0x51, 0x49, 0x46, // 2
0x22, 0x41, 0x49, 0x49, 0x36, // 3
0x18, 0x14, 0x12, 0x7F, 0x10, // 4
0x27, 0x45, 0x45, 0x45, 0x39, // 5
0x3E, 0x49, 0x49, 0x49, 0x32, // 6
0x01, 0x01, 0x71, 0x09, 0x07, // 7
0x36, 0x49, 0x49, 0x49, 0x36, // 8
0x26, 0x49, 0x49, 0x49, 0x3E, // 9
0x00, 0x36, 0x36, 0x00, 0x00, // :
0x00, 0x56, 0x36, 0x00, 0x00, // ;
0x08, 0x14, 0x22, 0x41, 0x00, // <
0x14, 0x14, 0x14, 0x14, 0x14, // =
0x00, 0x41, 0x22, 0x14, 0x08, // >
0x02, 0x01, 0x51, 0x09, 0x06, // ?
0x3E, 0x41, 0x59, 0x55, 0x5E, // @
0x7E, 0x09, 0x09, 0x09, 0x7E, // A
0x7F, 0x49, 0x49, 0x49, 0x36, // B
0x3E, 0x41, 0x41, 0x41, 0x22, // C
0x7F, 0x41, 0x41, 0x41, 0x3E, // D
0x7F, 0x49, 0x49, 0x49, 0x41, // E
0x7F, 0x09, 0x09, 0x09, 0x01, // F
0x3E, 0x41, 0x41, 0x49, 0x3A, // G
0x7F, 0x08, 0x08, 0x08, 0x7F, // H
0x00, 0x41, 0x7F, 0x41, 0x00, // I
0x30, 0x40, 0x40, 0x40, 0x3F, // J
0x7F, 0x08, 0x14, 0x22, 0x41, // K
0x7F, 0x40, 0x40, 0x40, 0x40, // L
0x7F, 0x02, 0x0C, 0x02, 0x7F, // M
0x7F, 0x02, 0x04, 0x08, 0x7F, // N
0x3E, 0x41, 0x41, 0x41, 0x3E, // O
0x7F, 0x09, 0x09, 0x09, 0x06, // P
0x1E, 0x21, 0x21, 0x21, 0x5E, // Q
0x7F, 0x09, 0x09, 0x09, 0x76};// R |
thanks |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Tue Feb 14, 2012 10:02 am |
|
|
I would 'think' that you could increase the size of the array from
FONT[51][5]
to
FONT[52][5]
then insert the correct data to create the degree symbol.
The LCD datasheet should have that information or use one of the online 'LCD font editors' that are available, or use a sheet of graphpaper to figure out the bit pattern you need based upon the ones you already have in the table. |
|
|
MegatroniC
Joined: 08 Dec 2009 Posts: 35
|
|
Posted: Tue Feb 14, 2012 1:21 pm |
|
|
Yes, i tried to increase the rows in the array to 52, before ask here.
I tried with another symbol added to the array.
But it shifted the remaining symbols and letters.
Then as i write a word ..., the display shows something else. (maybe i should add it to the end of the array?) |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9226 Location: Greensville,Ontario
|
|
Posted: Tue Feb 14, 2012 1:42 pm |
|
|
You can put it anywhere in the array but your 'character to font decoder' function(the code that decides what array values represent a character) has to be told where it is.
Without seeing the whole program...it's probably easiest to put at the END of the array [52]... |
|
|
MegatroniC
Joined: 08 Dec 2009 Posts: 35
|
|
Posted: Wed Feb 15, 2012 1:58 am |
|
|
Because the degree symbol belongs to the extended ASCII characters, can be added to the existing two arrays when replace an existing symbol.
For example, in place of @. When I write @, is displayed degree.
But this momentary decision, if not used @.
I added a new array FONT3:
Code: | const unsigned int8 FONT3[1][5]={0x07, 0x05, 0x07, 0x00, 0x00}; //Celcius° |
Also two lines in the function of fonts "glcd_text57":
Code: | for(; *textptr != '\0'; ++textptr, ++x)// Loop through the passed string
{
if(*textptr < 'S') // Checks if the letter is in the first font array
memcpy(pixelData, FONT[*textptr - ' '], 5);
else if(*textptr <= '~') // Check if the letter is in the second font array
memcpy(pixelData, FONT2[*textptr - 'S'], 5);
[b] else if(*textptr <= '°') // Check if the letter is in the third font array
memcpy(pixelData, FONT3[*textptr - '°'], 5); [/b]
else
memcpy(pixelData, FONT[0], 5); // Default to space |
Thanks @temtronic.
Have a nice day! |
|
|
|
|
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
|