Home > Uncategorized > Sample Aplikasi Atmega16 untuk LCD 16×2

Sample Aplikasi Atmega16 untuk LCD 16×2

Saniscaya Hadi (NIM: 41410110013)

Pramudya DW (NIM: 41410110090)


Berikut adalah cara membuat sample rangkaian dan program untuk LCD 16×2 menggunakan IC ATMega16.

Program yang digunakan:
1. Proteus ISIS 7
2. MikroC for AVR

Komponen yang digunakan dalam rangakaian:
1. IC ATMega16
2. Potensiometer
3. LCD 16×2
4. Crystal

Rangkaian seperti gambar diatas, sedangkan programnya ada di bawah ini:

sbit LCD_RS at PORTB.B2;
sbit LCD_EN at PORTB.B3;
sbit LCD_D4 at PORTB.B4;
sbit LCD_D5 at PORTB.B5;
sbit LCD_D6 at PORTB.B6;
sbit LCD_D7 at PORTB.B7;

sbit LCD_RS_Direction at DDRB.B2;
sbit LCD_EN_Direction at DDRB.B3;
sbit LCD_D4_Direction at DDRB.B4;
sbit LCD_D5_Direction at DDRB.B5;
sbit LCD_D6_Direction at DDRB.B6;
sbit LCD_D7_Direction at DDRB.B7;

char txt1[] = “Elektro 17″;
char txt2[] = “Mercu Buana”;
char txt3[] = “Contoh LCD”;
char txt4[] = “example”;

char i;

void Move_Delay() {
Delay_ms(500);
}

void main(){
Lcd_Init();
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);

Lcd_Out(1,6,txt3);
Lcd_Out(2,6,txt4);
Delay_ms(2000);
Lcd_Cmd(LCD_CLEAR);

Lcd_Out(1,1,txt1);
Lcd_Out(2,4,txt2);
Delay_ms(2000);

// Moving text
for(i=0; i<4; i++) {
Lcd_Cmd(LCD_SHIFT_RIGHT);
Move_Delay();
}

while(1) {
for(i=0; i<7; i++) {
Lcd_Cmd(LCD_SHIFT_LEFT);
Move_Delay();
}

for(i=0; i<7; i++) {
Lcd_Cmd(LCD_SHIFT_RIGHT);
Move_Delay();
}

}
}

Berikut adalah tutorial pembuatannya:



About these ads
  1. mameeen....
    January 15, 2011 at 11:58 pm

    nais inpoh…

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: