| ??? 02/04/03 05:29 Read: times |
#38235 - RE: Russian Alphabet for LCD |
For the Russian alphabet you may want to consider the possibility of using a graphics mode LCD controller. For example pick out a 64 x 128 type display. Then using one of the various font converter tools that converts a truetype font to a C data table you can build a font table for the Cyrillic font of your choice. Here is a link to a thread where a font converter was discussed here on the forum a short while ago....graphic LCD font generator application thread.
You can find a number of TrueType bitmap fonts that are suitable for conversion at this Russian Fonts web site. You need to scroll down the page a way as there are both Windows and Mac fonts listed. Once you have a font table here is some code and concepts I can share with you as to how to interface the font table to the graphics LCD graphics module. (I will leave it to you to pick a module and get it interfaced to your 8051 in some manner). This code abstracts the LCD interface above the low level subroutine interface level.
// use the method of interfacing to the LCD module through a bitmap
// array. Draw and write into this array and then when time to present
// the results you copy the array to the LCD controller memory.
// Here is a declaration for such an array. In this example the
// bytes in the memory image represent 8 bits of a horizontal row on
// the graphics display. Thus this display is 64 pixels wide x 128 tall.
#define X_BYTES 8
#define Y_BYTES 128
unsigned char xdata L_DisplayArray[X_BYTES][Y_BYTES];
// It is handy to then have a pixel translate table for
// masking the individual bytes in a byte. Here is such
// a table
const unsigned char code L_MaskArray[8] =
{0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
// here is a portion of the font table for the font pixels. In this
// example font is a fixed width and the bytes are organized as the
// horizontal rows of pixels in each character symbol. The first byte
// being the top with the MSB to the left side. Each character is 6
// pixels wide using the upper bits of each byte.
const unsigned char code font_7pt_horz[FONT_SIZE][FONT_WIDTH_7PT] = {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00}, /* sp */
{0x00,0x10,0x08,0xFC,0xFC,0x08,0x10}, /* -> mapped as ! */
{0x6C,0x6C,0x48,0x00,0x00,0x00,0x00}, /* " */
{0x68,0x68,0xfc,0x68,0xfc,0x68,0x68}, /* # */
{0x00,0x20,0x40,0xfc,0xfc,0x40,0x20}, /* <- mapped as $ */
{0xc4,0xcc,0x18,0x30,0x60,0xcc,0x8c}, /* % */
{0x30,0x50,0x20,0x50,0xcc,0xf8,0x74}, /* & */
// here is code for a subroutine that efficiently copies a font table
// entry to an arbitrary x/y position in the LCD image array.
// Arguments are:
// Column - x corrdinate of the left part of character
// Row - y coordinate of the top part of character
// CharWidth - size in pixels of the width of the character
// CharHeight - size in pixels of the length of the character
// String - an unsigned char pointer to the pixels to write
// assumed to be of length CharWidth
void lcd_write_char_to_display(unsigned char Column,
unsigned char Row,
unsigned char CharWidth,
unsigned char CharHeight,
unsigned char *String)
{
unsigned char BitPos;
unsigned char ByteOffset;
unsigned char XBits;
unsigned char RemainingBits;
unsigned char Mask;
unsigned char CharMask;
unsigned char Y;
unsigned char I;
BitPos = Column & 0x07; /* get the bit offset into a byte */
for (Y = Row,I = 0; Y < (Row + CharHeight); Y++,I++)
{
ByteOffset = Column >> 3; /* get the byte offset into x array */
XBits = CharWidth; /* get length of pixels to write */
RemainingBits = 8 - BitPos; /* how many bits remaining in byte */
CharMask = 0x80;
Mask = L_MaskArray[BitPos]; /* get the mask for this bit */
/* Boundary checking was added here to account for the possibility of */
/* write past the right boundary of the screen. */
while ((XBits) && (ByteOffset < 8)) /* while there are bits still to write */
{
/* first clear any bits in the position */
L_DisplayArray[ByteOffset][Y] &= ~Mask;
/* if the bit is set in the string then write the mask */
if (String[I] & CharMask)
{
L_DisplayArray[ByteOffset][Y] |= Mask;
}
CharMask >>= 1;
Mask >>= 1;
XBits--;
RemainingBits--;
if (RemainingBits == 0)
{
/* just crossed over a byte boundry, reset byte counts */
RemainingBits = 8;
ByteOffset++;
Mask = 0x80;
} /* end if (RemainingBits == 0) */
} /* end while (XBits) */
} /* end for (Y = Row,I = 0; Y < (Row + CharHeight); Y++,I++) */
}
// And then finally here is a subroutine that can be used to copy the
// array image to the actual LCD controller. Note that the LCD controller
// bit map image array is arranged as eight vertical stripes that are
// each 8 bits wide and correspond to the bytes across the image map
// array. This subroutine is designed to permit update of the LCD
// memory of any portion of the display from y=0 through y=127 but
// across the full width from x=0 to x=63. This subroutine supposes the
// presence of two generic subroutines for sending control and data
// information to the controller. For use on your system these would
// have to be provided and then appropriate tweaks made to the following
// routine
void lcd_update_display(unsigned char Top, unsigned char Bottom)
{
unsigned char X;
unsigned char Y;
unsigned char *colptr;
for (X = 0; X < X_BYTES; X++)
{
/* setup the page number for the X direction */
lcd_out_ctl(LCD_SET_PAGE+X); /* set page */
lcd_out_ctl(LCD_SET_COL_HI+(Top>>4)); /* set column from Y top */
lcd_out_ctl(LCD_SET_COL_LO+(Top&0x0F));
/* write all of the Y data */
colptr=&L_DisplayArray[7-X][Top]; /* address of column in array */
for(Y = Top; Y <= Bottom; Y++)
{
lcd_out_dat(*colptr++);
}
} /* end for (X = XStart; X <= XEnd; X++) */
}
Hope this gives some guidelines.... Michael Karas |
| Topic | Author | Date |
| Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD - Rob | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
| RE: Russian Alphabet for LCD | 01/01/70 00:00 | |
RE: Russian Alphabet for LCD | 01/01/70 00:00 |



