Machs doch so:

Code:
Config PortB = Input
Dim Zaeler as Integer

Do
  If PortB.0 = 1 then
    Zaeler = Zaeler + 1
    Do
    Loop until PortB.0 = 0
  End If
Loop