I'm writing some code for a photography application which looks for i/p A, then waits for i/p B to change state. I/P B should change within say 500msec max. My naive approach would be to just to stick the program in a FOR count = 1 to xxxx loop, check I/P B inside the loop and if it has changed jump out of the loop with a GOTO statement. Something is bugging me about this approach and it seems that there might be a better way, perhaps using an interrupt ? Any comments ? I've never programmed with interrupts before.

Also, is there an easy way of working out how many clock cycles a particular set of PBP instructions is going to take so I can calculate what to set the count to.

Thanks, Andrew