My question is, "Can this be made to work with less hardware? Can software be substituted for any of the hardware in this circuit using this 16F84A. If I can learn an easier way, I would like to try it.
Aaron
That depends. Why are you using a flip-flop? Using a flip-flop suggests you want to latch and hold these two signals when a clock edge occurs at a critical moment. And you wired the 7400 to be an XOR (exclusive OR) gate. This means you get a low output (which becomes an interrupt) when both flip-flop outputs are the same level, high or low.
If the A1 and A2 signals last long enough, you can get rid of the flip-flop and 7400. The circuit could be just the PIC using the flip-flop's present clock signal to start an interrupt at the PIC. If this is low-going, use RB0. If you want to fire on a high, use one of the interrupt-on-change pins. The first thing you do in the interrupt routine is read two pins with the A1 and A2 signals. Then you do a comparison asking if the two signals are the same logic level (which is what an XOR gate does) and process accordingly. If the same level, do this; if not, do something else.
>If they don't last long enough, then you must use the flip-flop to latch the two signals so they are still available to the PIC to read later. You can still use the same clock to interrupt the PIC.
>The next consideration is response time. Can you afford the clock cycles the PIC needs to read and determine signal levels? If not, the next question is, do you need to know what level the signals are at? If you use the XOR gate, you can interrupt using that, knowing it has already determined that the signals are the same level. If you don't need to know the levels, you can react instantly and do something in that case. Otherwise you have to take the time to read the levels and react accordingly.
Hope that helped.
kenjj