Well, I have done this progress bar in full line command (no bmp):
the first one:
_____________
|###________|
the second one:
| \/ |
|----+----------------|
| |
Here is is alpha num, but its continous pixels in my funcs.
Code:
void Graphic_LCD::Graphbar1(int x, int yb, int value , int lenth )
{
int i,limit,y,cs;
y = yb>>3; // y divided by 8
i = x;
limit = x + value; // calc limit between full & empty
// **** [ part ****
//_ This part of code is a quicker way to configure the right chip where we need
// |
if ((x) < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | (x&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((x-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
//_|
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
LCDInfo->DLPortIO1->PortW[DATA] = 0x7C; // send 0111 1100 <=> |
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
// **** first part / full part ****
while (++i<=limit) {
if (i < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | (i&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((i-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
LCDInfo->DLPortIO1->PortW[DATA] = 0x7C; // send 0111 1100 <=> |
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
}
// **** second part / empty part ****
while (++i<=(lenth-1))
if (i < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | (i&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((i-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
LCDInfo->DLPortIO1->PortW[DATA] = 0x44; // send 0100 0100 <=> :
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
}
// **** ] part ****
if ((x+lenth) < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | ((x+lenth)&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((x+lenth-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
LCDInfo->DLPortIO1->PortW[DATA] = 0x7C; // send 0111 1100 <=> |
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
}
void Graphic_LCD::Graphbar2(int x, int yb, int value , int lenth )
{
int i,y,cs;
y = yb>>3; // y divided by 8
i = x;
// **** [ part ****
//_ This part of code is a quicker way to configure the right chip where we need
// |
if ((x) < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | (x&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((x-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
//_|
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
LCDInfo->DLPortIO1->PortW[DATA] = 0x7C; // send 0111 1100 <=> |
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
// **** line part ****
while (++i<=(lenth-1))
if (i < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | (i&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((i-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
if ( (i==(value-1)) || (i==(value+1)) )
LCDInfo->DLPortIO1->PortW[DATA] = 0x40; // send 0100 0000 <=> _\/_
if (i==value)
LCDInfo->DLPortIO1->PortW[DATA] = 0x70; // send 0111 0000 <=> _|_
else
LCDInfo->DLPortIO1->PortW[DATA] = 0x40; // send 0001 0000 <=> ___
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
}
// **** ] part ****
if ((x+lenth) < 64) {
cs = LCD_CS1;
SendLCDCommand(DISPLAY_COLUMN_SET | ((x+lenth)&63), LCD_CS1);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS1);}
else {
cs = LCD_CS2;
SendLCDCommand(DISPLAY_COLUMN_SET | ((x+lenth-64)&63), LCD_CS2);
SendLCDCommand(DISPLAY_PAGE_SET | y, LCD_CS2);}
LCDInfo->DLPortIO1->PortW[CONTROL] = cs; // cs, rs=1, e=1
Delay();
LCDInfo->DLPortIO1->PortW[DATA] = 0x7C; // send 0111 1100 <=> |
Delay();
LCDInfo->DLPortIO1->PortW[CONTROL] = LCD_ENABLE | cs; // cs, rs=1, e=0
Delay();
}
It is optimized for speed &
It could have some bugs... (because I have done this yesterday night while watching the TV QI-Test program)