Professional Documents
Culture Documents
LCD Code
LCD Code
h>
#include<delay.h>
#define CPRT PORTB //Control port
#define DPRT PORTA //DATA port
#define RS PORTB.0
#define E PORTB.1
void init_LCD()
{
DDRA=0xFF;
E=0;
delay_ms(2); //Not Necessary
cmnd(0x38); //2 line 5x7 matrix
cmnd(0x0E); //display on,cursor on
cmnd(0x01); //clear LCD Screen
delay_ms(2); //Minimum 2 Milli-Seconds
cmnd(0x06); //shift cursor right
}
void main()
{
DDRA=0xFF;
DDRB=0xFF;
init_LCD(); //initialize LCD
lcd_goxy(1,1); //1st Row 1st Box
print("0123456789ABCDEF");
lcd_goxy(1,2); //2nd Row 1st Box
print("FEDCBA9876543210");
while(1); //Not Necessary
}