Code C graphic LCD #6

/////////////////////////////////////////////////////////////////////////
// Purpose: Write graphic on a graphic LCD
// Inputs: (x,y) – The upper left coordinate of the first letter
// id – Indicator of graphic table
// color – ON or OFF
// page – number of page display
/////////////////////////////////////////////////////////////////////////
void glcd_imag (int8 x,int8 y,char *imagptr ,int1 color,int8 page)
{
int8 i,j,k,l,cnt;
int8 pixelData;
l = x;j=0;
cnt = imagptr[0]; //
for(i=0;i<page;i++)
{
for(j=j; j<cnt; j++) // Loop through character byte data
{
pixelData = imagptr[j+1];
for(k=0; k<8; k++) // Loop through the vertical pixels
{
if(bit_test(pixelData, k)) // Check if the pixel should be set
{
glcd_pixel(x, y+k, color); // Draws the pixel
}
}
++x;
}
x = l;y +=8 ;cnt +=imagptr[0];
}

void clr_screen ()
{
glcd_fillScreen(OFF);
}

void glcd_num (int8 x,int8 y,char *textptr,int1 color)
{
int i, j, k, l, m, n, o, p=0,q; // Loop counters

BYTE pixelData[18]; // Stores character data
q = y;
for(i=0; textptr[i] != ”; ++i, ++x) // Loop through the passed string
{
if(textptr[i]< ‘0’ && textptr[i] > ‘9’)memset(pixelData,0,sizeof(pixelData));
else memcpy(pixelData, NUM[textptr[i]-‘0’], sizeof(pixelData));
for(o=0; o<2 ;++o)
{
for(j=0; j< 9; ++j,++p, x++) // Loop through character byte data
{
for(k=0; k<8; ++k) // Loop through the vertical pixels
{
if(bit_test(pixelData[p], k)) // Check if the pixel should be set
{
glcd_pixel(x, y+k, color); // Draws the pixel

}
}
}
x-=9;y+=8 ;
}
x+=10;y=q;p = 0;
}
}
#endif

Programming Click Now

ใส่ความเห็น

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / เปลี่ยนแปลง )

Twitter picture

You are commenting using your Twitter account. Log Out / เปลี่ยนแปลง )

Facebook photo

You are commenting using your Facebook account. Log Out / เปลี่ยนแปลง )

Google+ photo

You are commenting using your Google+ account. Log Out / เปลี่ยนแปลง )

Connecting to %s

%d bloggers like this: