• Tidak ada hasil yang ditemukan

Appendix Aplikasi Sensor Air Hujan dan LDR (Light Dependent Resistor) Untuk Alat Pengering Kopi Otomatis Berbasis ATMega 8

N/A
N/A
Protected

Academic year: 2018

Membagikan "Appendix Aplikasi Sensor Air Hujan dan LDR (Light Dependent Resistor) Untuk Alat Pengering Kopi Otomatis Berbasis ATMega 8"

Copied!
12
0
0

Teks penuh

(1)
(2)
(3)
(4)

LAMPIRAN 3 .LISTING PROGRAM SISTEM KERJA ALAT KESELURUHAN.

Progam

$regfile = "m8def.dat" $crystal = 16000000

Config Lcd = 16x2

Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.1 , Db6 = Portc.0 , Db7 = Portb.2 , E = Portc.3 , Rs = Portc.4

Cursor Off

Config Adc = Free , Prescaler = Auto , Reference = Avcc Start Adc

Tbl1 Alias Pind.0 Tbl2 Alias Pind.1 Tbl3 Alias Pind.2 Sensor_air Alias Pind.3 Limbuka Alias Pind.4 Limtutup Alias Pinb.1

M1 Alias Portd.6 M2 Alias Portd.7 V Alias Portd.5 Lampu Alias Portb.0

(5)

Dim Modealat As Bit Dim Posisi As Bit Dim Air As Bit

Dim Com_pintu As Bit Dim Com_relay As Bit

Enable Int0 Enable Interrupts

On Int0 Setting_mode

Dataset = 500 Set Com_pintu Set Com_relay

Gosub Buka

Awal: Cls

Gosub Tampilan Do

Gosub Auto If Tbl2 = 0 Then

Waitms 150 Gosub Manual End If

(6)

Loop

Auto:

Modealat = 1

Dataadc = Getadc(5)

If Dataadc > Dataset And Sensor_air = 1 Then 'Cuaca Cerah Gosub Buka

End If

If Dataadc <= Dataset And Sensor_air = 0 Then 'Mendung Hujan Gosub Tutup

End If

If Dataadc <= Dataset And Sensor_air = 1 Then 'Mendung tidak hujan Gosub Tutup

End If

If Dataadc > Dataset And Sensor_air = 0 Then 'Cerah hujan Gosub Tutup

End If

Gosub Update Return

Update:

Air = Sensor_air Dataadc = Getadc(5) Locate 1 , 6

Lcd " " Locate 1 , 7

(7)

Lcd "A" Else

Lcd "M" End If

Locate 1 , 16 Lcd " " Locate 1 , 16 If Posisi = 1 Then

Lcd "O" Else

Lcd "C" End If

Locate 2 , 6 Lcd " " Locate 2 , 6 Lcd Dataadc

Locate 2 , 16 Lcd " " Locate 2 , 16 Lcd Sensor_air Return

(8)

Lcd " "

Gosub Update Set M1

Reset M2 Toggle V Waitms 50

Loop Until Limbuka = 0 End If

Reset Lampu Reset M1 Reset M2 Reset V Return

(9)

Posisi = 0

If Limtutup = 1 Then Do

Gosub Update Reset M1 Set M2 Toggle V Waitms 50

Loop Until Limtutup = 0 End If

Set Lampu Reset M1 Reset M2 Reset V Return

Setting_mode: Disable Int0 Disable Interrupts Waitms 150 Cls

Locate 1 , 1

Lcd " Setting Data " Waitms 500

(10)

Locate 1 , 1 Lcd "ADC: " Locate 2 , 1 Lcd "Set: "

Do

Dataadc = Getadc(5) If Tbl1 = 0 Then

Incr Dataset Waitms 80 End If

If Tbl2 = 0 Then Decr Dataset Waitms 80 End If

Locate 1 , 5 Lcd " " Locate 1 , 5 Lcd Dataadc Locate 2 , 5 Lcd " " Locate 2 , 5 Lcd Dataset Waitms 80

(11)

Enable Int0 Enable Interrupts Goto Awal

Return

Manual: Disable Int0 Disable Interrupts Modealat = 0 Do

If Tbl1 = 0 Then Toggle Com_pintu Waitms 20

End If

If Tbl3 = 0 Then Toggle Com_relay Waitms 20

End If

If Com_pintu = 1 Then Gosub Buka

Else

Gosub Tutup End If

(12)

Set Lampu Else

Reset Lampu End If

Referensi

Dokumen terkait

2014 pada Satuan Kerja Perwakilan BKKBN Provinsi Jawa Barat akan melaksanakan Pelelangan Sederhana dengan pascakualifikasi secara elektronik untuk paket pekerjaan

Dengan memanjatkan puji syukur kepada allah swt, atas rahmat dan hidayah-nya yang diberikan kepada penyusun sehingga skripsi yang berjudul : “Pengaruh Kualitas

well as the volatility and correlation of returns, but increase expected returns, the market price of risk, and the price of the risky asset, (ii) although some of these effects

Our measure of misrepresentation identifies instances in which a first-lien loan is reported to investors as backed by property that has no associated higher liens when the

Fixed variable : Angle between plane and mirror // focal length(sila rujuk*).

Dalam rangka memperingati hari jadi SMK Negeri 21 Yogyakarta, Kami selaku pengurus OSIS SMK Negri 21 Yogyakarta akan melakukan acara peringatan dan santunan kepada anak yatim

Berdasarkan analisis hasil peneltian, maka dapat diambil kesimpulan, bahwa VCO secara topikal terhadap proses penyembuhan luka tekan grade grade I dan II lebih

Aplikasi tersebut adalah aplikasi Arduino I/O Controller yang berfungsi sebagai jembatan antara sistem dengan perangkat keras pada Arduino yaitu sensor dan relay,