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.

MSP-EXP432P4111: Can nout initialize the LCD ST7066U

Part Number: MSP-EXP432P4111

Hi,

I am trying to use an character LCD which controlled by ST7066U. I have MSP-EXP432P4111 and i am using IAR Workbench as compiler.I only have backlight and nothing more. Here is my code.

P4-Pin-0,1,2,3,5,6,6,7 are my data connections. P5 Pin0 is RS, P5 Pin1 is Enable. R/W is connected to ground. Thank you.

unsigned char CGRAM1[8] ={0x04,0x0E,0x15,0x04,0x04,0x04,0x04,0x04,};  
unsigned char CGRAM2[8] ={0x04,0x04,0x04,0x04,0x04,0x15,0x0e,0x04,};  
unsigned char CGRAM3[8] ={0x1f,0x11,0x11,0x11,0x11,0x11,0x11,0x1f,};  
unsigned char CGRAM4[8] ={0x0a,0x15,0x0a,0x15,0x0a,0x15,0x0a,0x15,};  


void WriteIns(char instruction)
{
	 P5->OUT ^= BIT0;
	 P4->OUT = instruction;
	 P5->OUT |= BIT1;          
	 for(i=0;i<1000;i++);		
	 P5->OUT ^= BIT1;
}
void WriteData(char data1)
{
	 P5->OUT |= BIT0;
	 P4->OUT = data1;
	 P5->OUT |= BIT1;
	 for(i=0;i<1000;i++);
	 P5->OUT ^= BIT1;
}
void WriteString(char count,char *MSG)
{
	char i;
	for(i = 0; i<count;i++)
            WriteData(MSG[i]);
	
}
void WriteString1(char count,char *MSG)
{
	char i;
	for(i = 0; i<count;i++){
            WriteData(MSG[i]);
	}
}
void Initial_ks0066()
{
	WriteIns(0x38);
	WriteIns(0x38);
	WriteIns(0x08);
	WriteIns(0x01);
	WriteIns(0x06);
}

void delay(char m)
{
	unsigned char i,j,k;
	for(j = 0;j<m;j++){
           for(k = 0; k<200;k++){
               for(i = 0; i<200;i++);}
        }	
}

void CGRAM()
{
	unsigned char i,j;
	WriteIns(0x40);   
	for(i = 0;i<8;i++){
	   WriteData(CGRAM3[i]);
	}
	WriteIns(0x48);	  
	for(j = 0;j<8;j++){
	   WriteData(CGRAM4[j]); //data write to CGRAM
	}
}

main(){
	P5->DIR |= BIT0;
        P5->DIR |= BIT1;
        P4->DIR |= 0xFF;
        
        Initial_ks0066();
	CGRAM();	
        WriteIns(0x80);
        WriteString1(8,"WINSTAR ");
        WriteIns(0xc0);
        WriteString1(8,"DISPLAY ");
        __bis_SR_register(LPM3_bits + GIE);        
}

**Attention** This is a public forum