This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Text String not Displaying on the Graphical LCD

Hello,

I have written a code for Graphical Serial LCD for displaying the Images on the Graphical LCD
The LCD is TIANAMA 128x64 with Hitachi Controller.

With help of this code i am able to show any graphics on the lcd, but i am not able to write any text in any line, It shows only raster image on the Screen.

Please guide for further to write 4 lines on the lcd.

#include <Philips\P89V66x.h>
#include <stdio.h>
#include <intrins.h>

#define SCK_bit 0
#define DIN_bit 2
#define SCK_set   P4 |= (1<<SCK_bit)
#define DIN_set   P4 |= (1<<DIN_bit)
#define SCK_clear P4 &= ~(1<<SCK_bit)
#define DIN_clear P4 &= ~(1<<DIN_bit)

sbit _CS = P2^3;
sbit _RST = P2^2;
sbit A0 = P2^1;

/* These are not working because P4 is located at 0xA1, not bit addressable with sbit extension
 * sbit SCK = P4^0;
 * sbit DIN = P4^2;
 */
unsigned char ContrastLevel;     // for contrast setting level

//-----------------------------------
// display data (128x64)
//-----------------------------------


unsigned char ContrastLevel;     // for contrast setting level

//-----------------------------------
// dispaly data (128x64)
//-----------------------------------

unsigned char code Logo[]=
{
...
...
};

//-----------------------------------
// Delay Routine
//-----------------------------------

void delayms(unsigned int m)        // 12MHz Xtal, close to ms value
{
    unsigned int j;
    unsigned int i;

    for(i=0; i<m; i++)
        for(j=0; j<109; j++)
            _nop_();
}

//-----------------------------------
// IO Routine
//-----------------------------------

void lcd_cmd(unsigned char Command)       //send command
{
    SCK_set;
    A0 = 0;
    _CS = 0;
        if (Command & 0x80) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x40) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x20) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x10) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x08) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x04) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x02) DIN_set; else DIN_clear; SCK_clear; SCK_set;
        if (Command & 0x01) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    _CS = 1;

}

void lcd_data(unsigned char DData)        //send data
{
    SCK_set;
    A0 = 1;
    _CS = 0;
    if (DData & 0x80) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x40) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x20) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x10) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x08) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x04) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x02) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    if (DData & 0x01) DIN_set; else DIN_clear; SCK_clear; SCK_set;
    _CS = 1;

}

//-----------------------------------
// Write a Screen
//-----------------------------------
void WriteScreen(unsigned char *DisplayData)    // DisplayData should be 164x64/8 = 1312byte
{
    unsigned char TempData;
    unsigned char i, j;
    for(i=0;i<8;i++)
        {
        lcd_cmd(0xb0 | i);    // select page 0~7
        lcd_cmd(0x10);        // start form column 4
        lcd_cmd(0x00);        // (2byte command)
        for(j=0;j<128;j++)
                {
            TempData=(*(DisplayData+(i*128)+j));
            lcd_data(TempData);
            }
        }
}

void lcd_string(unsigned char row_add, char *str_base)
{
        unsigned char i=0;
        lcd_cmd(row_add);
        while(str_base[i] != '\0')
        {
                lcd_data(str_base[i]);
                i++;
        }
}
//-----------------------------------
// Main Program
//-----------------------------------
void main()
{
     EA = 0;         // disable interrupts
    _CS = 1;
    _RST = 1;
    A0 = 1;
    SCK_set;
    DIN_set;

    initLCDM();
        LCD_Lighter();
        //WriteScreen(Logo);
        lcd_string(0x80,"Hello World");
    while(1);
}

Parents
  • Discussing for delays is out of focus for this case, since staster image is presented to GLCD.

    It seems that this method is successfull to send commands and data to GLCD for bitmap graphics.

    Is there other type of commands to send text and this rendered by the device ?

    The type/model/manufacturer of the GLCD never mentioned.
    LCD is TIANAMA 128x64 with Hitachi Controller ?

    A link to GLCD datasheet is never posted.

    A similar (successfull) case which is presented at:

    www.8052.com/.../GraphLCD.phtml

    There is described fonts, glyphs, ASCII, rendering etc.

    BUT this is not a copy paste case.

Reply
  • Discussing for delays is out of focus for this case, since staster image is presented to GLCD.

    It seems that this method is successfull to send commands and data to GLCD for bitmap graphics.

    Is there other type of commands to send text and this rendered by the device ?

    The type/model/manufacturer of the GLCD never mentioned.
    LCD is TIANAMA 128x64 with Hitachi Controller ?

    A link to GLCD datasheet is never posted.

    A similar (successfull) case which is presented at:

    www.8052.com/.../GraphLCD.phtml

    There is described fonts, glyphs, ASCII, rendering etc.

    BUT this is not a copy paste case.

Children