hello, i am working with pic18f4550 i have interfaced lcd with it.
i am trying to make generic functions to display strings on lcd.
when ever i use this santax i get garbage on lcd.
lcd_display_line((char*)"display this",12, LINE2);
but when i use this
#define bb[]="print this";
lcd_display_line(&bb[0],12,LINE2);
i dont get any error.
please help with the code.
i am trying to make generic functions to display strings on lcd.
when ever i use this santax i get garbage on lcd.
lcd_display_line((char*)"display this",12, LINE2);
but when i use this
#define bb[]="print this";
lcd_display_line(&bb[0],12,LINE2);
i dont get any error.
please help with the code.
Code:
void lcd_display_line(char* , char , char );
void main()
{
lcd_display_line([COLOR="Red"][B](char*)"display this",[/B][/COLOR]12, LINE1);
}
void lcd_display_line(char* line, char line_length, char line_number)
{
int n;
lcd_command(line_number);
for (n=0;n<line_length;n++)
{
LCD_senddata(*line);
line++;
}
void LCD_senddata(unsigned char var)
{
LCD_DATA = var; //Function set: 2 Line, 8-bit, 5x7 dots
LCD_RW = 0; //We are writing
LCD_RS = 1; //Selected data register
LCD_EN = 1; //Enable H->L
delay(180);
LCD_EN = 0;
delay(180);
}
Last edited: