Tänkte lägga upp min kod för en grafisk KS0108B display på 128x64 pixlar.
Den kan rita rektanglar/kvadrater, cirklar, linjer och text.
Exempel bilder:
Bild 1
Bild 2
Det fungerar iaf men kan säkert putsas lite också.
Just den här delen av koden ser ni på den första bilden, sen är det bara att kolla på Info delen för hur allt fungerar.
den här kan folk i alla fall använda om en grund så de slipper börja om från början, jag orkade bara kommentera det första men koden är rätt så straight forward, så här har ni koden:
Kod: Markera allt
/*
Info - How to use the commands.
1. LCD_Fill_Screen();
This command will fill the screen with pixels.
2. LCD_Clear_Screen();
This command will clear the screen of pixels.
3. LCD_Draw_Dot(x, y);
This command will draw a dot at the specified x, y location.
4. LCD_Clear_Dot(x, y);
This command will clear a dot at the specified x, y location.
5. LCD_Draw_Line(x1, y1, x2, y2, clr);
This command will draw a line from the specified cordinates (x1, y1) to the specified cordinates (x2, y2).
If clr is 1 it will clear all pixels of the line and if it is 0 it will draw a line.
6. LCD_Draw_Rect(x1, y1, x2, y2, fill, clr);
This command will draw a box from the specified cordinates (x1, y1) to the specified cordinates (x2, y2).
if fill is 1 it will fill the box and if it is 0 it will just make the outline of a box.
If clr is 1 it will clear all pixels of the box and if it is 0 it will draw the box.
7. LCD_Draw_Circle(x, y, R);
This command will draw a circle at the specified cordinates (x, y) with the radius 'R'.
8. LCD_Write_Char(x, y, 'char');
This command will draw a character ('char') at the specified cordinates (x, y), the x and y cordinates determins the character's top-left pixel.
9. LCD_Write_String(x, y, "string");
This command will draw a string ("string") at the specified cordinates (x, y), the x and y cordinates determins the string's top-left pixel.
*/
#include <avr/io.h>
#include <avr/pgmspace.h>
#include <util/delay.h>
// ---- LCD Definitions ----
#define LCD_DATA_PORT PORTD
#define LCD_DATA_PIN PIND
#define LCD_DATA_DDR DDRD
#define LCD_CONTROL_PORT PORTC
#define LCD_CONTROL_PIN PINC
#define LCD_CONTROL_DDR DDRC
#define LCD_RS 0
#define LCD_RW 1
#define LCD_ENABLE 2
#define LCD_CS1_PIN 3
#define LCD_CS2_PIN 4
#define LCD_RESET 5
#define DISPLAY_ON 0b00111111
#define DISPLAY_OFF 0b00111110
#define DISPLAY_STATUS_BUSY 0b10000000
#define DISPLAY_STATUS_ON_OFF 0b00100000
#define DISPLAY_STATUS_RESET 0b00010000
#define DISPLAY_LINE 0b11000000
#define ADDRESS_X 0b01000000
#define ADDRESS_Y 0b10111000
#define SET_CS1() (LCD_CONTROL_PORT |= (1<<LCD_CS1_PIN))
#define CLEAR_CS1() (LCD_CONTROL_PORT &= ~(1<<LCD_CS1_PIN))
#define SET_CS2() (LCD_CONTROL_PORT |= (1<<LCD_CS2_PIN))
#define CLEAR_CS2() (LCD_CONTROL_PORT &= ~(1<<LCD_CS2_PIN))
#define SET_ENABLE() (LCD_CONTROL_PORT |= (1<<LCD_ENABLE))
#define CLEAR_ENABLE() (LCD_CONTROL_PORT &= ~(1<<LCD_ENABLE))
#define SET_RW() (LCD_CONTROL_PORT |= (1<<LCD_RW))
#define CLEAR_RW() (LCD_CONTROL_PORT &= ~(1<<LCD_RW))
#define SET_RS() (LCD_CONTROL_PORT |= (1<<LCD_RS))
#define CLEAR_RS() (LCD_CONTROL_PORT &= ~(1<<LCD_RS))
// ------------
const unsigned char char_array[26][5] PROGMEM =
{
{0b01111110, 0b10010000, 0b10010000, 0b10010000, 0b01111110}, //A
{0b11111110, 0b10010010, 0b10010010, 0b10010010, 0b01101100}, //B
{0b01111100, 0b10000010, 0b10000010, 0b10000010, 0b01000100}, //C
{0b11111110, 0b10000010, 0b10000010, 0b01000100, 0b00111000}, //D
{0b11111110, 0b10010010, 0b10010010, 0b10010010, 0b10000010}, //E
{0b11111110, 0b10010000, 0b10010000, 0b10010000, 0b10000000}, //F
{0b01111100, 0b10000010, 0b10010010, 0b10010010, 0b01011100}, //G
{0b11111110, 0b00010000, 0b00010000, 0b00010000, 0b11111110}, //H
{0b10000010, 0b11111110, 0b10000010, 0, 0}, //I
{0b00001100, 0b00000010, 0b00000010, 0b00000010, 0b11111100}, //J
{0b11111110, 0b00010000, 0b00101000, 0b01000100, 0b10000010}, //K
{0b11111110, 0b00000010, 0b00000010, 0b00000010, 0b00000010}, //L
{0b11111110, 0b01000000, 0b00100000, 0b01000000, 0b11111110}, //M
{0b11111110, 0b01000000, 0b00111000, 0b00000100, 0b11111110}, //N
{0b01111100, 0b10000010, 0b10000010, 0b10000010, 0b01111100}, //O
{0b11111110, 0b10010000, 0b10010000, 0b10010000, 0b01100000}, //P
{0b01111000, 0b10000100, 0b10000100, 0b10000110, 0b01111010}, //Q
{0b11111110, 0b10010000, 0b10011000, 0b10010100, 0b01100010}, //R
{0b01100100, 0b10010010, 0b10010010, 0b10010010, 0b01001100}, //S
{0b10000000, 0b10000000, 0b11111110, 0b10000000, 0b10000000}, //T
{0b11111100, 0b00000010, 0b00000010, 0b00000010, 0b11111100}, //U
{0b11100000, 0b00011100, 0b00000010, 0b00011100, 0b11100000}, //V
{0b01111100, 0b00000010, 0b00011100, 0b00000010, 0b01111100}, //W
{0b10000010, 0b01101100, 0b00010000, 0b01101100, 0b10000010}, //X
{0b11100000, 0b00010000, 0b00011110, 0b00010000, 0b11100000}, //Y
{0b10000110, 0b10001010, 0b10010010, 0b10100010, 0b11000010} //Z
};
const unsigned char schar_array[26][5] PROGMEM =
{
{0b00011110, 0b00100100, 0b00100100, 0b00011110, 0}, //a
{0b00111110, 0b00101010, 0b00101010, 0b00010100, 0}, //b
{0b00011100, 0b00100010, 0b00100010, 0b00100010, 0}, //c
{0b00111110, 0b00100010, 0b00100010, 0b00011100, 0}, //d
{0b00111110, 0b00101010, 0b00101010, 0b00100010, 0}, //e
{0b00111110, 0b00101000, 0b00101000, 0b00100000, 0}, //f
{0b00011100, 0b00100010, 0b00101010, 0b00101100, 0}, //g
{0b00111110, 0b00001000, 0b00001000, 0b00111110, 0}, //h
{0b00100010, 0b00111110, 0b00100010, 0, 0}, //i
{0b00000100, 0b00100010, 0b00100010, 0b00111100, 0}, //j
{0b00111110, 0b00001000, 0b00010100, 0b00100010, 0}, //k
{0b00111110, 0b00000010, 0b00000010, 0b00000010, 0}, //l
{0b00111110, 0b00010000, 0b00001000, 0b00010000, 0b00111110}, //m
{0b00111110, 0b00010000, 0b00001000, 0b00000100, 0b00111110}, //n
{0b00011100, 0b00100010, 0b00100010, 0b00100010, 0b00011100}, //o
{0b00111110, 0b00101000, 0b00101000, 0b00010000, 0}, //p
{0b00011000, 0b00100100, 0b00100110, 0b00011010, 0}, //q
{0b00111110, 0b00101000, 0b00101000, 0b00010110, 0}, //r
{0b00010010, 0b00101010, 0b00101010, 0b00100100, 0}, //s
{0b00100000, 0b00100000, 0b00111110, 0b00100000, 0b00100000}, //t
{0b00111100, 0b00000010, 0b00000010, 0b00111100, 0}, //u
{0b00110000, 0b00001100, 0b00000010, 0b00111100, 0}, //v
{0b00111100, 0b00000010, 0b00001100, 0b00000010, 0b00111100}, //w
{0b00100010, 0b00010100, 0b00001000, 0b00010100, 0b00100010}, //x
{0b00110000, 0b00001000, 0b00000110, 0b00001000, 0b00110000}, //y
{0b00100110, 0b00101010, 0b00101010, 0b00110010, 0} //z
};
const unsigned char num_array[10][5] PROGMEM =
{
{0b01111100, 0b10100010, 0b10010010, 0b10001010, 0b01111100}, //0
{0b01000010, 0b11111110, 0b00000010, 0, 0}, //1
{0b01001110, 0b10001010, 0b10010010, 0b10010010, 0b01100010}, //2
{0b01000100, 0b10000010, 0b10010010, 0b10010010, 0b01101100}, //3
{0b11110000, 0b00010000, 0b00010000, 0b00010000, 0b11111110}, //4
{0b11110010, 0b10010010, 0b10010010, 0b10010010, 0b10001100}, //5
{0b01111100, 0b10010010, 0b10010010, 0b10010010, 0b01001100}, //6
{0b10000000, 0b10000000, 0b10001110, 0b10010000, 0b11100000}, //7
{0b01101100, 0b10010010, 0b10010010, 0b10010010, 0b01101100}, //8
{0b01100000, 0b10010000, 0b10010000, 0b10010000, 0b01111110} //9
};
const unsigned char sign_array[22][5] PROGMEM =
{
{0b01110000, 0b10001010, 0b01110000, 0, 0}, // !
{0b11000110, 0b11001000, 0b00010000, 0b00100110, 0b11000110}, // %
{0b00000010, 0b00001100, 0b00110000, 0b11000000, 0}, // /
{0b01111100, 0b10000010, 0, 0, 0}, // (
{0b10000010, 0b01111100, 0, 0, 0}, // )
{0b11111110, 0b10000010, 0, 0, 0}, // [
{0b10000010, 0b11111110, 0, 0, 0}, // ]
{0b00010000, 0b01101100, 0b10000010, 0, 0}, // {
{0b10000010, 0b01101100, 0b00010000, 0, 0}, // }
{0b00101000, 0b00101000, 0b00101000, 0, 0}, // =
{0b01100000, 0b10000000, 0b10001010, 0b10010000, 0b01100000}, // ?
{0b00010000, 0b00111000, 0b00010000, 0, 0}, // +
{0b00010000, 0b00010000, 0b00010000, 0, 0}, // -
{0b00000010, 0, 0, 0, 0}, // .
{0b00100100, 0, 0, 0, 0}, // :
{0b00000010, 0b00000010, 0b00000010, 0b00000010, 0b00000010}, // _
{0b11000000, 0, 0, 0, 0}, // ´
{0b11111110, 0, 0, 0, 0}, // |
{0b01000000, 0b10100000, 0b01000000, 0, 0}, // *
{0b00100000, 0b01000000, 0b10000000, 0b01000000, 0b00100000}, // ^
{0b00010000, 0b00101000, 0b01000100, 0, 0}, // <
{0b01000100, 0b00101000, 0b00010000, 0, 0} // >
};
void LCD_Init(void);
void LCD_Wait(void);
void LCD_RTS(void);
void LCD_Fill_Screen(void);
void LCD_Clear_Screen(void);
void LCD_Send_Cmd(unsigned char);
void LCD_Send_Data(unsigned char);
void LCD_Set_Pos(unsigned char, unsigned char);
void LCD_Draw_Dot(unsigned char, unsigned char);
void LCD_Clear_Dot(unsigned char, unsigned char);
void LCD_Draw_Line(char, char, char, char, unsigned char);
void LCD_Draw_Rect(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char, unsigned char);
void LCD_Draw_Circle(unsigned char, unsigned char, unsigned char);
void LCD_Write_Char(unsigned char, unsigned char, char);
void LCD_Write_String(unsigned char, unsigned char, char *);
unsigned char LCD_Read_Data(void);
unsigned int abs(int);
volatile unsigned char lcd_x = 0, lcd_y = 0;
int main(void)
{
LCD_Init();
LCD_RTS();
while(1);
return 0;
}
void LCD_RTS(void)
{
LCD_Clear_Screen();
LCD_Draw_Line(1, 0, 126, 0, 0);
LCD_Draw_Line(1, 63, 126, 63, 0);
LCD_Draw_Line(0, 1, 0, 62, 0);
LCD_Draw_Line(127, 1, 127, 62, 0);
LCD_Draw_Dot(1, 1);
LCD_Draw_Dot(1, 62);
LCD_Draw_Dot(126, 1);
LCD_Draw_Dot(126, 62);
LCD_Draw_Line(2, 10, 125, 10, 0);
LCD_Draw_Line(1, 9, 2, 9, 0);
LCD_Draw_Line(1, 11, 2, 11, 0);
LCD_Draw_Line(125, 9, 126, 9, 0);
LCD_Draw_Line(125, 11, 126, 11, 0);
LCD_Draw_Line(2, 31, 125, 31, 0);
LCD_Draw_Line(1, 30, 2, 30, 0);
LCD_Draw_Line(1, 32, 2, 32, 0);
LCD_Draw_Line(125, 30, 126, 30, 0);
LCD_Draw_Line(125, 32, 126, 32, 0);
LCD_Draw_Line(2, 52, 125, 52, 0);
LCD_Draw_Line(1, 51, 2, 51, 0);
LCD_Draw_Line(1, 53, 2, 53, 0);
LCD_Draw_Line(125, 51, 126, 51, 0);
LCD_Draw_Line(125, 53, 126, 53, 0);
LCD_Clear_Dot(0, 10);
LCD_Clear_Dot(0, 31);
LCD_Clear_Dot(0, 52);
LCD_Clear_Dot(127, 10);
LCD_Clear_Dot(127, 31);
LCD_Clear_Dot(127, 52);
LCD_Write_String(13, 2, "Pb Charger by Korken");
LCD_Write_String(4, 13, "Battery Info:");
LCD_Write_String(4, 22, "Charge Completed!");
LCD_Write_String(4, 34, "Timer: 03:41:27");
LCD_Write_String(4, 43, "Stat: Tickle Charge...");
LCD_Write_String(10, 54, "elektronikforumet.com");
}
void LCD_Init(void)
{
LCD_CONTROL_DDR = 0xFF;
LCD_DATA_DDR = 0xFF;
LCD_CONTROL_PORT &= ~(1<<LCD_RESET);
_delay_loop_2(20);
LCD_CONTROL_PORT |= (1<<LCD_RESET);
SET_CS1();
CLEAR_CS2();
LCD_Send_Cmd(DISPLAY_ON);
SET_CS2();
CLEAR_CS1();
LCD_Send_Cmd(DISPLAY_ON);
SET_CS1();
SET_CS2();
}
void LCD_Wait(void)
{
LCD_DATA_DDR = 0x00; // Set DDR to input.
CLEAR_RS(); // Set Instruction/Data pin to low
SET_RW(); // Set Read/Write to Read (high)
SET_ENABLE();
while(LCD_DATA_PIN & DISPLAY_STATUS_BUSY); // Do loop until LCD isn't busy anymore
CLEAR_ENABLE();
}
void LCD_Send_Cmd(unsigned char cmd)
{
LCD_Wait(); // Wait for LCD to be ready for commands
CLEAR_RS(); // Set Instruction/Data pin to low
CLEAR_RW(); // Set Read/Write to Write (low)
LCD_DATA_DDR = 0xFF; // Set DDR to output
LCD_DATA_PORT = cmd; // Send the data
SET_ENABLE(); // Pulse Enable
_delay_loop_2(20);
CLEAR_ENABLE();
}
void LCD_Send_Data(unsigned char data)
{
LCD_Wait(); // Wait for LCD to be ready for commands
SET_RS(); // Set Instruction/Data pin to high
CLEAR_RW(); // Set Read/Write to Write (low)
LCD_DATA_DDR = 0xFF; // Set DDR to output
LCD_DATA_PORT = data; // Send data
SET_ENABLE(); // Pulse Enable
_delay_loop_2(20);
CLEAR_ENABLE();
}
unsigned char LCD_Read_Data(void)
{
LCD_Wait(); // Wait for LCD to be ready for commands
LCD_DATA_DDR = 0x00; // Set DDR to output
SET_RS(); // Set Instruction/Data pin to high
SET_RW(); // Set Read/Write to Read (high)
SET_ENABLE(); // Set Enable high
_delay_loop_2(20);
CLEAR_ENABLE(); // Set Enable low
unsigned char data = LCD_DATA_PIN; // Get data
return data;
}
void LCD_Set_Pos(unsigned char x, unsigned char y)
{
lcd_x = x;
lcd_y = y;
unsigned char tmp = 0;
if (lcd_x > 63)
{
SET_CS2();
CLEAR_CS1();
tmp = (lcd_x - 64);
}
else
{
SET_CS1();
CLEAR_CS2();
tmp = lcd_x;
}
LCD_Send_Cmd(ADDRESS_X | tmp);
LCD_Send_Cmd(ADDRESS_Y | lcd_y);
SET_CS2();
CLEAR_CS1();
LCD_Send_Cmd(DISPLAY_LINE);
SET_CS1();
CLEAR_CS2();
LCD_Send_Cmd(DISPLAY_LINE);
if (lcd_x > 63)
{
SET_CS2();
CLEAR_CS1();
}
else
{
SET_CS1();
CLEAR_CS2();
}
}
void LCD_Draw_Dot(unsigned char x, unsigned char y)
{
LCD_Set_Pos(x, y/8);
unsigned char tempdata = LCD_Read_Data();
tempdata = LCD_Read_Data();
LCD_Set_Pos(x, y/8);
LCD_Send_Data(tempdata | (1<<(y % 8)));
}
void LCD_Clear_Dot(unsigned char x, unsigned char y)
{
LCD_Set_Pos(x, y/8);
unsigned char tempdata = LCD_Read_Data();
tempdata = LCD_Read_Data();
LCD_Set_Pos(x, y/8);
LCD_Send_Data(tempdata & ~(1<<(y % 8)));
}
void LCD_Fill_Screen(void)
{
for(unsigned char y = 0; y < 8; y++)
{
for(unsigned char x = 0; x < 128; x++)
{
LCD_Set_Pos(x, y);
LCD_Send_Data(0xFF);
}
}
}
void LCD_Clear_Screen(void)
{
for(unsigned char y = 0; y < 8; y++)
{
for(unsigned char x = 0; x < 128; x++)
{
LCD_Set_Pos(x, y);
LCD_Send_Data(0x00);
}
}
}
void LCD_Draw_Line(char x0, char y0, char x1, char y1, unsigned char clr)
{
int dy = y1 - y0;
int dx = x1 - x0;
int stepx, stepy;
if (dy < 0)
{
dy = -dy;
stepy = -1;
}
else
{
stepy = 1;
}
if (dx < 0)
{
dx = -dx;
stepx = -1;
}
else
{
stepx = 1;
}
dy <<= 1;
dx <<= 1;
if (clr) LCD_Clear_Dot(x0, y0);
else LCD_Draw_Dot(x0, y0);
if (dx > dy)
{
int fraction = dy - (dx >> 1);
while (x0 != x1)
{
if (fraction >= 0)
{
y0 += stepy;
fraction -= dx;
}
x0 += stepx;
fraction += dy;
if (clr) LCD_Clear_Dot(x0, y0);
else LCD_Draw_Dot(x0, y0);
}
}
else
{
int fraction = dx - (dy >> 1);
while (y0 != y1)
{
if (fraction >= 0)
{
x0 += stepx;
fraction -= dy;
}
y0 += stepy;
fraction += dx;
if (clr) LCD_Clear_Dot(x0, y0);
else LCD_Draw_Dot(x0, y0);;
}
}
}
void LCD_Draw_Rect(unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, unsigned char fill, unsigned char clr)
{
if (fill != 0)
{
for (unsigned char i = y1; i <= y2; i++)
LCD_Draw_Line(x1, i, x2, i, clr);
}
else
{
LCD_Draw_Line(x1, y1, x2, y1, clr);
LCD_Draw_Line(x1, y2, x2, y2, clr);
LCD_Draw_Line(x2, y1, x2, y2, clr);
LCD_Draw_Line(x1, y1, x1, y2, clr);
}
}
void LCD_Draw_Circle(unsigned char x1, unsigned char y1, unsigned char radius)
{
int f = 1 - radius;
int ddF_x = 0;
int ddF_y = -2 * radius;
int x = 0;
int y = radius;
LCD_Draw_Dot(x1, y1 + radius);
LCD_Draw_Dot(x1, y1 - radius);
LCD_Draw_Dot(x1 + radius, y1);
LCD_Draw_Dot(x1 - radius, y1);
while(x < y)
{
if(f >= 0)
{
y--;
ddF_y += 2;
f += ddF_y;
}
x++;
ddF_x += 2;
f += ddF_x + 1;
LCD_Draw_Dot(x1 + x, y1 + y);
LCD_Draw_Dot(x1 - x, y1 + y);
LCD_Draw_Dot(x1 + x, y1 - y);
LCD_Draw_Dot(x1 - x, y1 - y);
LCD_Draw_Dot(x1 + y, y1 + x);
LCD_Draw_Dot(x1 - y, y1 + x);
LCD_Draw_Dot(x1 + y, y1 - x);
LCD_Draw_Dot(x1 - y, y1 - x);
}
}
unsigned int abs(int num)
{
if (num >= 0)
return num;
else
return -num;
}
void LCD_Write_Char(unsigned char x, unsigned char y, char ch)
{
if (ch == ' ')
{
lcd_x += 4;
return;
}
unsigned char ch_data[5] = {0, 0, 0, 0, 0};
if((ch >= 'A') && (ch <= 'Z'))
{
ch_data[0] = pgm_read_byte(&char_array[ch - 'A'][0]);
ch_data[1] = pgm_read_byte(&char_array[ch - 'A'][1]);
ch_data[2] = pgm_read_byte(&char_array[ch - 'A'][2]);
ch_data[3] = pgm_read_byte(&char_array[ch - 'A'][3]);
ch_data[4] = pgm_read_byte(&char_array[ch - 'A'][4]);
}
else if((ch >= 'a') && (ch <= 'z'))
{
ch_data[0] = pgm_read_byte(&schar_array[ch - 'a'][0]);
ch_data[1] = pgm_read_byte(&schar_array[ch - 'a'][1]);
ch_data[2] = pgm_read_byte(&schar_array[ch - 'a'][2]);
ch_data[3] = pgm_read_byte(&schar_array[ch - 'a'][3]);
ch_data[4] = pgm_read_byte(&schar_array[ch - 'a'][4]);
}
else if((ch >= '0') && (ch <= '9'))
{
ch_data[0] = pgm_read_byte(&num_array[ch - '0'][0]);
ch_data[1] = pgm_read_byte(&num_array[ch - '0'][1]);
ch_data[2] = pgm_read_byte(&num_array[ch - '0'][2]);
ch_data[3] = pgm_read_byte(&num_array[ch - '0'][3]);
ch_data[4] = pgm_read_byte(&num_array[ch - '0'][4]);
}
else
{
unsigned char i = 0xFF;
switch(ch)
{
case '!': i = 0; break;
case '%': i = 1; break;
case '/': i = 2; break;
case '(': i = 3; break;
case ')': i = 4; break;
case '[': i = 5; break;
case ']': i = 6; break;
case '{': i = 7; break;
case '}': i = 8; break;
case '=': i = 9; break;
case '?': i = 10; break;
case '+': i = 11; break;
case '-': i = 12; break;
case '.': i = 13; break;
case ':': i = 14; break;
case '_': i = 15; break;
case '´': i = 16; break;
case '|': i = 17; break;
case '*': i = 18; break;
case '^': i = 19; break;
case '<': i = 20; break;
case '>': i = 21; break;
default: break;
}
if (i != 0xFF)
{
ch_data[0] = pgm_read_byte(&sign_array[i][0]);
ch_data[1] = pgm_read_byte(&sign_array[i][1]);
ch_data[2] = pgm_read_byte(&sign_array[i][2]);
ch_data[3] = pgm_read_byte(&sign_array[i][3]);
ch_data[4] = pgm_read_byte(&sign_array[i][4]);
}
}
if (ch_data[0] != 0)
{
for(unsigned char a = 0; a < sizeof(ch_data); a++)
{
for(unsigned char i = 0; i < 8; i++)
{
if ((ch_data[a] == 0) || ((x + a) > 127))
break;
if (ch_data[a] & 0x80)
LCD_Draw_Dot((x + a), (y + i));
ch_data[a] <<= 1;
}
}
}
}
void LCD_Write_String(unsigned char x, unsigned char y, char *s)
{
unsigned char i = 0;
while(s[i])
{
LCD_Write_Char(x, y, s[i]);
x = (lcd_x + 2);
if (lcd_x > 127)
return;
i++;
}
}

//Emil