JM35
Joined: 10 Feb 2009 Posts: 10
|
max size of an array in rom ? |
Posted: Wed Mar 04, 2009 12:22 pm |
|
|
I use a 16f877 for driving a 128*64 LCD.
I need a table of 475 bytes i wish, of course, to place in rom for saving ram
Code: |
const int8 ascii[] = {
0x0,0x0,0x0,0x0,0x0, // 32 -esp- 20
0x0,0x0,0x4F,0x0,0x0, // 33 - ! - 21
0x0,0x7,0x0,0x7,0x0, // 34 - " - 22
0x14,0x7F,0x14,0x7F,0x14, // 35 - # - 23
0x24,0x2A,0x7F,0x2A,0x12, // 36 - $ - 24
0x23,0x13,0x8,0x64,0x62, // 37 - % - 25
0x36,0x49,0x55,0x22,0x50, // 38 - & - 26
0x0,0x5,0x3,0x0,0x0, // 39 - ' - 27
0x1C,0x22,0x41,0x0,0x0, // 40 - ( - 28
0x0,0x0,0x41,0x22,0x1C, // 41 - ) - 29
0x14,0x8,0x3E,0x8,0x14, // 42 - * - 2A
0x8,0x8,0x3E,0x8,0x8, // 43 - + - 2B
0x0,0x50,0x30,0x0,0x0, // 44 - , - 2C
0x8,0x8,0x8,0x8,0x8, // 45 - - - 2D
0x0,0x60,0x60,0x0,0x0, // 46 - . - 2E
0x20,0x10,0x8,0x4,0x2, // 47 - / - 2F
0x3E,0x51,0x49,0x45,0x3E, // 48 - 0 - 30
0x0,0x42,0x7F,0x40,0x0, // 49 - 1 - 31
0x42,0x61,0x51,0x49,0x46, // 50 - 2 - 32
0x21,0x41,0x45,0x4B,0x31, // 51 - 3 - 33
0x18,0x14,0x12,0x7F,0x10, // 52 - 4 - 34
0x27,0x45,0x45,0x45,0x39, // 53 - 5 - 35
0x3C,0x4A,0x49,0x49,0x30, // 54 - 6 - 36
0x1,0x71,0x9,0x5,0x3, // 55 - 7 - 37
0x36,0x49,0x49,0x49,0x36, // 56 - 8 - 38
0x06,0x49,0x49,0x29,0x1E, // 57 - 9 - 39
0x0,0x36,0x36,0x0,0x0, // 58 - : - 3A
0x0,0x56,0x36,0x0,0x0, // 59 - ; - 3B
0x8,0x14,0x22,0x41,0x0, // 60 - < - 3C
0x14,0x14,0x14,0x14,0x14, // 61 - = - 3D
0x0,0x41,0x22,0x14,0x8, // 62 - > - 3E
0x2,0x1,0x51,0x9,0x6, // 63 - ? - 3F
0x32,0x49,0x79,0x41,0x3E, // 64 - @ - 40
0x7E,0x11,0x11,0x11,0x7E, // 65 - A - 41
0x7F,0x49,0x49,0x49,0x36, // 66 - B - 42
0x3E,0x41,0x41,0x41,0x22, // 67 - C - 43
0x7F,0x41,0x41,0x22,0x1C, // 68 - D - 44
0x7F,0x49,0x49,0x49,0x41, // 69 - E - 45
0x7F,0x9,0x9,0x9,0x1, // 70 - F - 46
0x3E,0x41,0x49,0x49,0x7A, // 71 - G - 47
0x7F,0x8,0x8,0x8,0x7F, // 72 - H - 48
0x0,0x41,0x7F,0x41,0x0, // 73 - I - 49
0x20,0x40,0x41,0x3F,0x1, // 74 - J - 4A
0x7F,0x8,0x14,0x22,0x41, // 75 - K - 4B
0x7F,0x40,0x40,0x40,0x40, // 76 - L - 4C
0x7F,0x2,0xC,0x2,0x7F, // 77 - M - 4D
0x7F,0x4,0x8,0x10,0x7F, // 78 - N - 4E
0x3E,0x41,0x41,0x41,0x3E, // 79 - O - 4F
0x7F,0x9,0x9,0x9,0x6, // 80 - P - 50
0x3E,0x41,0x51,0x21,0x5E, // 81 - Q - 51
0x7F,0x9,0x19,0x29,0x46, // 82 - R - 52
0x46,0x49,0x49,0x49,0x31, // 83 - S - 53
0x1,0x1,0x7F,0x1,0x1, // 84 - T - 54
0x3F,0x40,0x40,0x40,0x3F, // 85 - U - 55
0x1F,0x20,0x40,0x20,0x1F, // 86 - V - 56
0x3F,0x40,0x38,0x40,0x3F, // 87 - W - 57
0x63,0x14,0x8,0x14,0x63, // 88 - X - 58
0x7,0x8,0x70,0x8,0x7, // 89 - Y - 59
0x61,0x51,0x49,0x45,0x43, // 90 - Z - 5A
0x7F,0x41,0x41,0x0,0x0, // 91 - [ - 5B
0x2,0x4,0x8,0x10,0x20, // 92 - \ - 5C
0x0,0x0,0x41,0x41,0x7F, // 93 - ] - 5D
0x4,0x2,0x1,0x2,0x4, // 94 - ^ - 5E
0x40,0x40,0x40,0x40,0x40, // 95 - _ - 5F
0x0,0x1,0x2,0x4,0x0, // 96 - ` - 60
0x20,0x54,0x54,0x54,0x78, // 97 - a - 61
0x7F,0x48,0x44,0x44,0x38, // 98 - b - 62
0x38,0x44,0x44,0x44,0x20, // 99 - c - 63
0x38,0x44,0x44,0x48,0x7F, // 100 d - 64
0x38,0x54,0x54,0x54,0x18, // 101 e - 65
0x8,0x7E,0x9,0x1,0x2, // 102 f - 66
0xC,0x52,0x52,0x52,0x3E, // 103 g - 67
0x7F,0x8,0x4,0x4,0x78, // 104 h - 68
0x0,0x44,0x7D,0x40,0x0, // 105 i - 69
0x0,0x20,0x40,0x44,0x3D, // 106 j - 6A
0x7F,0x10,0x28,0x44,0x0, // 107 k - 6B
0x0,0x41,0x7F,0x40,0x0, // 108 l - 6C
0x7C,0x4,0x18,0x4,0x78, // 109 m - 6D
0x7C,0x8,0x4,0x4,0x78, // 110 n - 6E
0x38,0x44,0x44,0x44,0x38, // 111 o - 6F
0x7C,0x14,0x14,0x14,0x8, // 112 p - 70
0x8,0x14,0x14,0x18,0x7C, // 113 q - 71
0x7C,0x8,0x4,0x4,0x8, // 114 r - 72
0x48,0x54,0x54,0x54,0x20, // 115 s - 73
0x4,0x3F,0x44,0x40,0x20, // 116 t - 74
0x3C,0x40,0x40,0x20,0x7C, // 117 u - 75
0x1C,0x20,0x40,0x20,0x1C, // 118 v - 76
0x3C,0x40,0x30,0x40,0x3C, // 119 w - 77
0x44,0x28,0x10,0x28,0x44, // 120 x - 78
0xC,0x50,0x50,0x50,0x3C, // 121 y - 79
0x44,0x64,0x54,0x4C,0x44, // 122 z - 7A
0x8,0x36,0x41,0x0,0x0, // 123 { - 7B
0x0,0x0,0x7F,0x0,0x0, // 124 | - 7C
0x0,0x0,0x41,0x36,0x8, // 125 } - 7D
0x0,0x8,0x4,0x8,0x4 // 126 ~ - 7E
};
|
here's the function for accessing the character :
Code: |
void lcd_putchar(unsigned char c){
// FONT_MIN = 32 -esp- 20 // 5 octets par caractère
// FONT_MAX = 126 ~ - 7E
unsigned char cpt;
unsigned int16 index;
if ((c<32)||(c>126)) c='?';
(char)c=(char)c-32;
index = (long)c*5; // *5=*(4+1)= <<2 +1
for(cpt=5; cpt>0; cpt--){
lcd_putdata(ascii[index++]);
lcd_compteur();
}
lcd_putdata(0); // 1 colonne vide (espace inter caractères)
lcd_compteur();
}
|
It don't work with CCS PCM C Compiler, Version 4.073, why ?
The code is OK with Hi-Tech compiler ...
Thank's ! |
|