Hello

New to PIC's but not to programming.

Currently I am counting input pluses with a PIC 16f886 at 20khz.

I am doing some thing like

IF pin high THEN
X=X+1

(not exact code but I am sure you get the gerneral idea)

The problem I am haveing is that the code is long and has quite a few RS232 outs
and by the time the logic loops back around to the IF statement I have missed counts.

Is there some special counting command I should be thinking of useing or can a make a pin a interupt that has precendence over what is going on ?

My only concern if there is a interupt fuction that I can not cut a RS232 string out in half.

Any thoughs ?

Mark