This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LCD 16x1 only 8 characters from left

Other Parts Discussed in Thread: MSP430G2231

Hello. I try to display one line of characters with a 16x1 lcd module (first type module, with 2 memory line), 4 bits mode but it only shows 8 chars from left. I modified the project "LCD with MSP430" found in the list of MSP430 projects. Here is the code:

/*
•                  MSP430uc        LCD_Module
•                  P12                     RS
•                  P13                     E
•                  P14                     D4
•                  P15                     D5
•                  P16                     D6
•                  P17                     D7
•                  GND                     GND
*/

#include <msp430g2231.h>

char disp[16];
int i,o;

void delay (char);
void init_lcd(void);
void clr_lcd(void);
void string(char *what);
void strobe(void);
void putchar(char what);

int main(void)
{
    WDTCTL = WDTPW + WDTHOLD;
    for(o=0; o<0xEF;o++)
    delay(145);
    init_lcd();
    clr_lcd();
    string("AAAAAAAAAAAA");
}

void init_lcd(void)
{
    P1DIR=0xFF;
    P1OUT=0xFF;

    P1OUT=P1OUT|0x08;
    P1OUT=P1OUT&0xFB;
    P1OUT=0x2F;
    P1OUT=P1OUT & 0xFB;
    strobe();

//HN
    P1OUT=0x2F;
    P1OUT=P1OUT & 0xFB;
    strobe();
//LN
    P1OUT=0x8F;
    P1OUT=P1OUT & 0xFB;
    strobe();

//Home position
//HN
    P1OUT=0x0F;
    P1OUT=P1OUT & 0xFB;
    strobe();
//LN
    P1OUT=0x3F;
    P1OUT=P1OUT & 0xFB;
    strobe();

}

void string(char *str)
{
    char pos;
    clr_lcd();
    for (pos=0;pos<16;pos++)
    {
        putchar(str[pos]);
    }
}

void putchar(char ascii)
{
    //HN
    P1OUT=0x0F|ascii;
    P1OUT=P1OUT|0x01;
    delay(115);
    strobe();

    //LN
    P1OUT=0x0F|(ascii<<4);
    strobe();

}

The idea is to display 16 characters starting with home position (function string()) but I only get 8 chars starting from left. If someone know wh please help me. Thanks

  • Depending on the LCD, the 16 characters might not be in continuous memory on teh LCD controller. Maybe the same hardware is used for  a 2x8 display. And/or other configurations.

    Reason is that the internal position is often directly related to the row/column matrix signal mapping of the display driver. Which does not necessarily fit the 'external' appearance.

    Try to write more than 16 chars (as if it were a 1x256 display) and see whether some (and which) chars appear on position 8..16.

**Attention** This is a public forum