Thank you very much for all the comments!!!! I do appreciate them! You guys are masters!!

I have not tried you guys advises yet, I have been busy these couple days. But I will surely try them out once I free up myself!

To reply the questions #2 from BigWumpus, I connected my PORTA.1~4 to a single digit display through a decoder; and since its just a display, I don't need to read it back. I do like your #3 suggestion though! Thanks a lot!


Quote Originally Posted by BigWumpus
1. mistake:
You defined the variable COUNTER on PARTA. Why ?
If you read this 8 bits back, they represent the digital attached signals from the pins.
You should define it as a simple variable (Var byte).

2....:
you write to Counter, but never read it back ?

3....:
maybe you can throw away the if-thens by using counter=Potenzial*10/256 with some other steps