Quote Originally Posted by The Master View Post
Hmm. Im making lights dim. I would say the timing is pretty important on that and the hardware interrupt looks like it would work best.

What i want is serin2 to wait to serial data forever (or until it gets some data).

If RB0/INT goes low then i want to run a sub.

Does what you said mean that the data coming in from serin2 could be currupted?

Im not really sure what to do now. Ive been reading through those 2 links but they arnt making much sense to me and i cant relate them to what im doing
You can't use serin2 and hardware interrupts at the same time. The serin2 command is a software loop watching for the pin to toggle. If you interrupt out of that, then you lose bits or bytes. If you must watch RB0, then you also must use the hardware usart with a hserin command.

If you are using RB0 as an interrupt, then you could use a loop to watch for the uart buffer to be full. Using the usart gives you the advantage of a 1.9 byte buffer. I say 1.9 because you get one full byte, plus however long it takes to receive another byte and move it there before its overwritten.

You really should get a development board and play with the serial inputs and the interrupts to see how it works. If you don't do that, then you'll be depending on the board to write your code.