WStevens_sa
Member level 2
- Joined
- Jan 5, 2011
- Messages
- 47
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- South Africa
- Activity points
- 1,695
Hi all
Trying to figure out how to send info to LCD 2x16. Running a bit into a snag. The code below I found on the web. I am trying to understand the methods of communication with an LCD using f877. I am using Real Pic Simulator 1.3 to simulate.
First problem On compiling "MikroC"
8 393 'lcd_cmd' Identifier redefined LCD 2 x 6.c
Second problem I cannot Identify which pins from the f877 go to where on the LCD. I have a feeling that the pins are already configured somewhere else and this is why it complains about the "Identifier redefined"
Trying to figure out how to send info to LCD 2x16. Running a bit into a snag. The code below I found on the web. I am trying to understand the methods of communication with an LCD using f877. I am using Real Pic Simulator 1.3 to simulate.
First problem On compiling "MikroC"
8 393 'lcd_cmd' Identifier redefined LCD 2 x 6.c
Second problem I cannot Identify which pins from the f877 go to where on the LCD. I have a feeling that the pins are already configured somewhere else and this is why it complains about the "Identifier redefined"
int k;
char ch;
void delay_ms()
{
for(k=0;k<100;k++);
}
void lcd_cmd(ch)
{
PORTD=ch; //sending character element on port
PORTC=0x04;
delay_ms(100); //to wait for character to write on lcd
PORTC=0x00;
}
void lcd_data(char ch)
{
PORTD=ch;
PORTC=0x05;
delay_ms(100);
PORTC=0x01;
}
void init_lcd()
{
lcd_cmd(0x3); // function set (set interface length)
lcd_cmd(0x0E); //enable cursor display
//lcd_cmd(0x01); //clear display
//lcd_cmd(0x06); //entry mode set
//lcd_cmd(0x1C); //move cursor
}
void main(void)
{
char str[] = "Welcome";
int len;
int i;
TRISC=0;
TRISD=0;
init_lcd();
len=sizeof(str);
for( i=0;i<=len;i++) //for sending commands character by character
{
lcd_data(str);
}
lcd_cmd(0x0c);
lcd_cmd(0x02);
}