Re: PIC18F repeats operation several times although it's not supposed to
Oh and you can't pass a variable to __delay_us() because it is NOT a function, it is a macro.
You can get a variable delay by making your own function that loops and calls __delay_us(1) repeatedly.
(Although it will run a bit slower than you expect due to loop overheads)
To get a useful answer, always state which PIC you are using!