Code:
$regfile = "m8def.dat"
$crystal = 3686400

Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.3 , Rs = Portd.2

Config Lcd = 16 * 2
Cursor Off
Config Portd = Output
Config Pinc.0 = Input
Portc.0 = 1
Dim X As Byte
Cls

Do
If Pinc.0 = 0 Then
Incr X
Locate 1 , 10
Lcd X
While Pinc.0 = 0
Wend
end if
loop
End