پروژه های ramin.yousefi2@gmail.com AVR,ARM,PIC,8051

لطفا ایمیل بزنید

Library
LCD charactery :
int lcd_gotoxy( unsigned int x, unsigned int y)
{
int retval = 0;
if( (x > 1) && (y > 15) )
{
retval = -1;
}
 
else
{
if( x == 0 )
{
lcd_cmd_write( 0x80 + y );
/* command - position cursor at 0x00 (0x80 + 0x00 ) */
}
else if( x==1 )
{
lcd_cmd_write( 0xC0 + y ); /* command - position cursor at 0x40 (0x80 + 0x00 ) */
}
}
return retval;
}
 
 
 
void lcd_clear()
{
lcd_cmd_write(0x01);
lcd_gotoxy(0,0);
}
void lcd_putsf(unsigned char const *str)
{
while(*str)
{
lcd_putchar(*str++);
}
}




void lcd_init()
{
lcd_all_dir_out;
delay(10);
lcd_rs(0);
lcd_write_4bit(0x3);
delay(10);
lcd_write_4bit(0x3);
delay(10);
lcd_write_4bit(0x3);
lcd_write_4bit(0x2);
lcd_cmd_write(0x28); lcd_cmd_write(0x0C); lcd_cmd_write(0x06);
}