TUGAS MIKROPROSESOR

February 12, 2011 Leave a comment

Di Susun oleh :

1). KRISTIAN SENDI P.B. NIM : 41410110044
2). TREA FERRY WICAKSONO NIM : 41410110096

preview rangkaian

Berikut adalah cara membuat rangkaian dan program 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

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

nsigned int adc_rd;
// LCD module connections
sbit LCD_RS at PORTC.B2;
sbit LCD_EN at PORTC.B3;
sbit LCD_D4 at PORTC.B4;
sbit LCD_D5 at PORTC.B5;
sbit LCD_D6 at PORTC.B6;
sbit LCD_D7 at PORTC.B7;

sbit LCD_RS_Direction at DDRC.B2;
sbit LCD_EN_Direction at DDRC.B3;
sbit LCD_D4_Direction at DDRC.B4;
sbit LCD_D5_Direction at DDRC.B5;
sbit LCD_D6_Direction at DDRC.B6;
sbit LCD_D7_Direction at DDRC.B7;
// End LCD module connections

char tulisan[] = “PKK_UMB_TE_17”;

void main() {
Lcd_Init(); // Initialize LCD
Lcd_Cmd(LCD_CLEAR); // Clear display
Lcd_Cmd(LCD_CURSOR_OFF); // Cursor off

Lcd_Out(1,3,tulisan); // Write text in first row
while (1) {
adc_rd = ADC_Read(0); // get ADC value from 0th channel
IntToStr(adc_rd, tulisan);
Lcd_Out(2,6,tulisan);
}
}

Tutorial pembuatan :

Categories: Uncategorized

Sample Aplikasi Atmega16 untuk LCD 16×2

January 15, 2011 1 comment

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: