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