Ich habe einen internen Pull-Up-Widerstand genutzt. Also so sieht der Quelltext aus, mit dem ich die Schaltung getestet habe.

Code:
$regfile = "m32def.dat"
$crystal = 16000000

Config Lcd = 20 * 4
Config Lcdpin = Pin , Db4 = Portc.0 , Db5 = Portc.1 , Db6 = Portc.2 , Db7 = Portc.3 , E = Portc.5 , Rs = Portc.4
Config Lcdbus = 4


Config Pind.2 = Input

Config Portd.2 = 1

Enable Interrupts

Cls

Initlcd
Dim D As Integer
Enable Interrupts



D = 0


Do
If Portd.2 = 0 Then D = D + 1

Locate 1 , 1
Lcd D
Loop
End