Anda di halaman 1dari 5

Calculator Digital Januari 16, 2010

Posted by elektro12 in Project AVR.


add a comment

Berikut tahap-tahap dalam membuat Calculator Digital dengan AVR


Alat-alat yang dibutuhkan adalah sebagai berikut:
1. ATMEGA-16
2. Keypad-Small-Calc
3. LM016 (LCD)
Langkah selanjutnya adalah melakukan simulasi dengan menggunakan beberapa software
pendukung, software yang dibutuhkan adalah:
1. Proteus(ISIS 7 Professional)
2. Bascom-AVR
Mari kita mulai untuk melakukan simulasi terlebih dahulu:
1. Buatlah rangkaian sesuai dengan gambar di bawah ini dengan menggunakan Software
Proteus(ISIS 7 Profesional):
2. setelah selesai merangkai gunakan software Bascom-AVR dengan mengetikkan kode
sebagai berikut:
$regfile = m16def.dat
$crystal = 1000000
Config Kbd = Portd , Debounce = 30
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.4 , Db5 = Portb.5 , Db6 = Portb.6 , Db7 = Portb.7 , Rs =
Portb.3 , E = Portb.2

Dim A As Byte
Dim B As Byte
Dim Key As Byte
Dim C As Byte
Dim D As Byte
Dim E As Byte
Dim F As Byte
Cls
Cursor Off
Locate 2 , 1
Lcd calculator dig
E=0
B=0
Q:
Waitms 200
B = 0
A = Getkbd()
If A > 15 Then
Goto Q
Else
Key = Lookup(a , Dta)
If Key <= 9 Then
D=0
B = 10 * B
B = B + Key
If E = 0 Then C = B
If E = 1 Then D = B
Cls : Lcd B
Elseif Key = 10 Then
Cls
F=1
E=1
B=0
Elseif Key = 11 Then
Cls
E=1
F=2
B=0
Elseif Key = 12 Then
Cls
E=1
F=3
B=0
Elseif Key = 15 Then
Cls
E=1
F=4
B=0

Elseif Key = 13 Then


Cls
E=0
B=0
Elseif Key = 14 Then
If E = 1 Then
Cls
Select Case F
Case 1 :
B=C/D
Case 2:
B=C*D
Case 3:
B=CD
Case 4:
B=C+D
End Select
Lcd B
End If
End If
End If
Locate 2 , 1
Lcd "calculator dig"
Goto Q
End
Dta:
Data 7 , 8 , 9 , 10 , 4 , 5 , 6 , 11 , 1 , 2 , 3 , 12 , 13 , 0 , 14 , 15
Download source

Thermostat Digital Januari 16, 2010


Posted by elektro12 in Project AVR.
add a comment

Berikut tahap-tahap dalam membuat Thermometer Digital yang berfungsi juga sebagai
pengatur suhu ruangan dengan AVR :
Alat-alat yang dibutuhkan adalah sebagai berikut:
1. ATMEGA-16
2. Crystal -> 18.432 Mhz
3. Oven -> Sebagai pengganti heater Ruangan
4. Motor -> Sebagai pengganti Air Conditioner
5. Relay -> sebagai pengontol ON/OFF motor
6. COMPIM -> pemberi informasi ke PC/terminal
Langkah selanjutnya adalah melakukan simulasi dengan menggunakan beberapa software
pendukung, software yang dibutuhkan adalah:
1. Proteus(ISIS 7 Professional)
2. Micro C(AVR).
Mari kita mulai untuk melakukan simulasi terlebih dahulu:
1. Buatlah rangkaian sesuai dengan gambar di bawah ini dengan menggunakan Software
Proteus(ISIS 7 Profesional):
2. setelah selesai merangkai gunakan software Micro C(AVR) dengan mengetikkan kode
sebagai berikut:

// 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 txt[]=Thermometer Dig;
char chVAL[16];
unsigned int A=0;
int temp;
void main(){
UART1_Init(9600);
DDRB=0xFF;
Lcd_Init();
Lcd_Cmd(LCD_CLEAR);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Out(1,1,txt);
Delay_ms(100);
Lcd_Cmd(LCD_CLEAR);
Lcd_Out(2,8,celc);
while(1){
A=ADC_Read(0);
temp=(A+1)*100/205;
IntToStr(temp,chVAL);
Lcd_Out(2,1,chVAL);
Delay_ms(1000);
if (temp=20 && temp30){
PORTB.B1=1;
PORTB.B2=1;
Lcd_Out(1,1,);
Lcd_Out(1,1,HEAT=OFF,FAN= ON);
UART1_Write_Text( Status HOT : Heater OFF, FAN ON\r \n);}
}
}

3. untuk lebih detailnya perhatikan video berikut ini:


Download video

Anda mungkin juga menyukai