100% found this document useful (1 vote)
41 views

Program LCD

This document describes a program that changes the text displayed on an LCD screen when a push button is pressed. The LCD is connected to Port B and the push button is connected to Port D.2. When the button is pressed, the LCD displays "Belajar Mikro" and "Codevision AVR" and when not pressed displays "WELCOME" and "Mikrokontroler". The program was written in Codevision AVR and simulated using Proteus.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
41 views

Program LCD

This document describes a program that changes the text displayed on an LCD screen when a push button is pressed. The LCD is connected to Port B and the push button is connected to Port D.2. When the button is pressed, the LCD displays "Belajar Mikro" and "Codevision AVR" and when not pressed displays "WELCOME" and "Mikrokontroler". The program was written in Codevision AVR and simulated using Proteus.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Latihan berikut ini untuk membuat tampilan LCD berubah tulisannya ketika push button di tekan.

Setelah
ditekan maka tulisan menjadi kembali tulisan awalnya. LCD
diletakan di PortB sedangkan push button ada di PortD.2.
Compiler yang dipakai adalah Codevision AVR dan simulasi Proteus.
Berikut Listing Program di Codevision AVR
/*****************************************************
Chip type : ATmega8535
Program type : Application
AVR Core Clock frequency: 12.000000 MHz
Memory model : Small
External RAM size : 0
Data Stack size : 128
*****************************************************/
#include

#include
#asm
.equ __lcd_port=0x18 ;PORTB
#endasm
void main(void)
{
PORTB=0x00;
DDRB=0x00;
PORTD=0x04; //untuk memfungsikan portD.2
DDRD=0x00;
ACSR=0x80;
SFIOR=0x00;
lcd_init(16);
while (1)

{
if (PIND.2==0)
{
lcd_gotoxy(1,0);
lcd_putsf("Belajar Mikro ");
lcd_gotoxy(1,1);
lcd_putsf("Codevision AVR ");
}
else
{
lcd_gotoxy(1,0);
lcd_putsf(" WELCOME ");
lcd_gotoxy(1,1);
lcd_putsf("Mikrokontroler ");
}
}
}

You might also like