Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
161 views

Program Sensor Ping Bascom

This document contains code for an LCD display demo that reads input pulses from a pin and displays the timer value. It initializes the LCD, sets the input and output pins, and uses a timer to measure the time between pulses. The main loop displays the current timer value on the LCD after each pulse is received.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
161 views

Program Sensor Ping Bascom

This document contains code for an LCD display demo that reads input pulses from a pin and displays the timer value. It initializes the LCD, sets the input and output pins, and uses a timer to measure the time between pulses. The main loop displays the current timer value on the LCD after each pulse is received.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

$regfile = m16.

dat
$crystal = 8000000
Config Lcd = 16 * 2
Config Lcdbus = 4
Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Port
c.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 diaktifk
an
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

You might also like