0% found this document useful (0 votes)
8 views1 page

LCD

Uploaded by

Koussay Mlik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views1 page

LCD

Uploaded by

Koussay Mlik
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

void lcd_cmd(unsigned char cmd) {

PORTC = (cmd & 0xF0);


EN = 1;
RW = 0;
RS = 0;
__delay_ms(2);
EN = 0;
PORTC = ((cmd << 4) & 0xF0);
EN = 1;
RW = 0;
RS = 0;
__delay_ms(2);
EN = 0;
}
void lcd_data(unsigned char data) {
PORTC = (data & 0xF0);
EN = 1;
RW = 0;
RS = 1;
__delay_ms(2);
EN = 0;

PORTC = ((data << 4) & 0xF0);


EN = 1;
RW = 0;
RS = 1;
__delay_ms(2);
EN = 0;
}
void lcd_init() {
lcd_cmd(0x02);
lcd_cmd(0x28);
lcd_cmd(0x0C);
lcd_cmd(0x06);
lcd_cmd(0x01);
__delay_ms(2);
}
void lcd_string(const char* str) {
unsigned char i = 0;
while (str[i] != '\0') {
lcd_data(str[i]);
i++;
}
}

You might also like