$regfile = "m8def.dat"
$crystal = 8000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portb.0 , Db5 = Portb.1 , Db6 = Portb.2 , Db7 = Portb.3 , E = Portb.5 , Rs = Portb.4
Config Timer1 = Timer , Prescale = 8
Config Int1 = Rising
Enable Interrupts
Enable Int1
On Int1 Receive
Dim A As Single , B As Single , C As Byte
C = 0
A = 0
B = 0
Config Pind.6 = Output
Cls
Cursor Off
Do
Start Timer1
Set Portd.6
Waitus 100
Reset Portd.6
Loop
End
Receive:
Stop Timer1
Reset Portd.6
C = 0
A = 0
B = 0
A = Timer1
B = A
If A > 8000 Then
Cls
Locate 1 , 1
Lcd "OUT OF RANGE"
Goto Down
End If
A = A / 100
Cls
Home
Lcd A
Locate 2 , 1
Lcd B
Down:
Timer1 = 0
A = 0
B = 0
Return