Algoritma dan Program Sensor Jarak

Posted: Mei 11, 2012 in Tugas Artikel

$regfile = “m8535.dat” $crystal = 8000000 Config Lcd = 16 * 2 Config Lcdbus = 4 Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.1 , Rs = Portc.0 Config Timer1 = Timer , Prescale = 64 Sigout Alias Portb.0 Sigin Alias Pinb.0 Dirsig Alias Ddrb.0 Dim Data_timer As Integer ‘================================================== Inisialisasi: Waitms 100 Initlcd Locate 1 , 1 Lcd “demo ping” Wait 1 Cls Utama: Gosub Ambil_datatimer Locate 1 , 1 Lcd Data_timer Wait 1 Cls Goto Utama ‘================================================== Ambil_datatimer: Dirsig = 1 Set Sigout ‘bankitkan pulsa Waitus 10 Reset Sigout ‘terima pulsa ubah dulu jadi input Dirsig = 0 ‘jadi input Set Sigout ‘pull up internal diaktifkan Bitwait Sigin , Set Data_timer = 0 Timer1 = 0 Start Timer1 Do If Sigin = 0 Then Data_timer = Timer1 Stop Timer1 Exit Do End If If Tifr.2 = 1 Then ‘cek register timer1 overflow? Stop Timer1 Tifr.2 = 1 Data_timer = 0 Exit Do End If Loop Stop Timer1 Return

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