Kalkulator Digital Sederhana dengan ATmega8535

Kali ini saya akan membahas bagai mana untuk membuat sebuah kalkulator sederhana dengan ATmega8535 yang ditampilkan di layar LCD

 

Kalkulator Digital Simulasi di Proteus

Berikut Adalah SourceCode nya dengan Bahsa Basic Assembler
$regfile = “m8535.dat”
$crystal = 12000000

Config Kbd = Portd , Debounce = 30
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5
Config Lcdpin = Pin , E = Portc.1 , Rs = Portc.0

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 Mini”
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 = C – D
Case 4:
B = C + D
End Select
Lcd B
End If
End If
End If
Locate 2 , 1
Lcd “Calculator Mini”

Goto Q
End
Dta:
Data 7 , 8 , 9 , 10 , 4 , 5 , 6 , 11 , 1 , 2 , 3 , 12 , 13 , 0 , 14 , 15

Untuk lebih lanjut, Jika anda penasaran silahkan download file simulasi proteus beserta sourcecodenya disini
Selamat mencoba, Trimakasih sudah berkunjung 😀

Iklan

About zhiescreamous

Pecinta Lingkungan Hidup, Persaudaraan Gn.Puntang Indonesia | Computer Enggineering | UNIKOM

Posted on 17/11/2012, in Mikrokontroller. Bookmark the permalink. Tinggalkan komentar.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: