Komponen yang diperlukan :
- Atmega8535 x1
- LCD 16 x 2 x1
- IC LM35 x1
- kristal 16Mhz x1
- R. 47Ohm x1
- R. 4K7 x1
- C. 22pf x2
- C. 10nF x1
- C. 1mF x1
- V.R. 10K x1
Dan inilah source codenya!
$crystal = 16000000
Dim W As Word , T As Word , Led As Byte , Led1 As Byte , I As Byte
Declare Sub Lcd_bar()
Deflcdchar 0 , 32 , 32 , 32 , 32 , 32 , 32 , 32 , 32 ‘ replace ? with number (0-7)
Deflcdchar 1 , 16 , 16 , 16 , 16 , 16 , 16 , 16 , 16 ‘ replace ? with number (0-7)
Deflcdchar 2 , 24 , 24 , 24 , 24 , 24 , 24 , 24 , 24 ‘ replace ? with number (0-7)
Deflcdchar 3 , 28 , 28 , 28 , 28 , 28 , 28 , 28 , 28 ‘ replace ? with number (0-7)
Deflcdchar 4 , 30 , 30 , 30 , 30 , 30 , 30 , 30 , 30 ‘ replace ? with number (0-7)
Deflcdchar 5 , 31 , 31 , 31 , 31 , 31 , 31 , 31 , 31 ‘ replace ? with number (0-7)
Deflcdchar 6 , 12 , 18 , 18 , 12 , 32 , 32 , 32 , 32 ‘ replace ? with number (0-7)
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.2 , Db4 = Portc.4 ,
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
Cls
Cursor Off
Locate 2 , 1
Lcd “Suhu:”
Start Adc
Do
W = Getadc(0)
T = W / 2
Locate 2 , 6
Lcd T ; Chr(6) ; “C “
Waitms 200
Lcd_bar
Loop
End
Sub Lcd_bar:
Led = T / 5
Led1 = T Mod 5
If Led > 1 Then
Locate 1 , 1
For I = 1 To Led
Lcd Chr(5)
Next
If Led >= 1 Then Lcd Chr(led1) ; “ “
Elseif Led < 1 Then
Locate 1 , 1
Lcd Chr(t) ; “ “
Else
Locate 1 , 1
Lcd Chr(led1) ; “ “
End If
End Sub
Semoga postingan saya kai ini bernmanfaat!
Jika ada pertanyaan, kritik maupun saran bisa comment dibawah!
Bagi yang mau berbagi artikel ini harap menyertakan sumbernya ya.....
Baca juga :
- Cara menghitung nilai resistor
- Komponen - komponen dasar elektronika
- Elektronika dasar
- Rangkaian alram menggunakan PIC16F84A
- Rangkaian USB Downloader menggunakan ATmega8535
- Jenis - jenis resistor
- Jenis - jenis SCR
- Jenis - jenis transistor
- Jenis - jenis kapasitor
- Jenis - jenis diode
0 Comment:
Post a Comment