lcd interfacing with atmega16(with header file)

#include <avr/io.h>
#include<util/delay.h>
#include"lcd.h"
int main(void)
{
  lcd_init();
  display("SONU_KUMAR_FABULOUS");
}




//THE HEADER FILE IS:-
oid lcdcmd(char x)
{DDRD=0b11111111;
         DDRC=0b11111111;
PORTD=x;
PORTC=0b00000100;
_delay_ms(10);
PORTC=0b00000000;
_delay_ms(10);
}
void lcddata(char x)
{
DDRD=0b11111111;
         DDRC=0b11111111;
PORTD=x;
        PORTC=0b00000101;
_delay_ms(10);
PORTC=0b00000001;
_delay_ms(10);
}
void display(char a[])
{
DDRD=0b11111111;
         DDRC=0b11111111;

       int i;
for(i=0;a[i]!='\0';i++)
{lcddata(a[i]);

}
}
void lcd_init()
{
lcdcmd(0x38);
lcdcmd(0x0E);
lcdcmd(0x01);
}



Comments

Popular posts from this blog

AVR MICROCONTROLLER