The other code doesn't work, because the capacitor doesn't discharge.

I am using a WIMA MKS 4 0,01/250-N4 capacitor, I guess that means 10nF.

The resistor is 40K.

That should mean it takes 0,00004 seconds to charge and at a maximum the same to recharge due to - er - well-intended voltage levels.

Then I am recharging it, while counting, but it doesn't stop. When short circuiting the capacitor it works, so the code is OK.

Is this cap no 10nF - cap ?

Is there anything to be changed in the code ?

ADCWert = 0
Trisa.3 = 0
High Porta.3

Pauseus 244


Trisa.3 = 1
High Gruene_LED
WHILE Porta.3 = 1
ADCWert = ADCWert + 1
WEND
Low Gruene_LED
Zaehler = 600 - ( (600 / 1200) * ADCWert) ;to keep time even
Pauseus Zaehler
RETURN