Iam trying to interface msp430g2553 with 16X2 coomon hitachi LCD in 8 bit mode.
Iam using CCS v6
RS---> Port 2, BIT0
Enable---->Port2, BIT1
dataline=PORT1
vcc 5v , gnd is common and BIT0,BIT 6 jumpers removed
I sure the circuit are ok because in this way I worked in Energia successfully in 4 bit mode
But not working in CCS, my code is attached below ...help....
#include <msp430g2553.h>
void delay1(void);//delay function
void command(void);
void data(void);
void delayms(unsigned int);
int i,j,k;
void main()
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
//P1REN=0XFF;
//P2REN=0xFF;
P1DIR=0XFF;
P2OUT=0X00;
P1OUT=0X00;
P2OUT=0X00;
delayms(200);
P1OUT=0x38;////to select the mode of the LED 0X38 - 8 bit 2 lines
command();// Call command function
delayms(10);
P1OUT=0x38;
command();// Call command function
delayms(10);
P1OUT=0x06;// // to activate entry mode
command();// Call command function
delayms(10);
P1OUT=0x0F;////to get a blinking curser display
command();////To show that the given values are command
delayms(10);
P1OUT=0x42;//character to print
data();// //To show that the given values are data
delayms(10);
}
void delay1()//delay function
{
i=0,j=0;
for(i=0;i<100;i++)
{
j++;
}
}
void command()//command function definition
{
P2OUT &= ~BIT0;
P2OUT |=BIT1;
//delay1();
__delay_cycles(100);
P2OUT &=~BIT1;
}
void data()////data function definition
{
P2OUT |=BIT0;
P2OUT |=BIT1;
//delay1();
__delay_cycles(100);
P2OUT &=~BIT1;
}
/******************************************* delayms Function declaration***********************************************/
void delayms(unsigned int val)
{
k=0;
for(i=0;i<=val;i++)
{
for(j=0;j<=100;j++)
{
k++;
}
}
}