Any statements that are timed by software ... Pulsin/out, Serin/out, pause, Debug and others will be disturbed by interrupts. That's just the nature of interrupts.

You should use Hardware whenever possible.
For serial data, use the USART.
Don't know how you'll read the IR.
<br>