I'm trying to use an interrupt, which will occur on a rising edge of a signal coming from my LSM303DLHC accelerometer. The accelerometer has a Data Ready (DRDY) signal that fires every time new data is added to the registers I've read from and I want to use this signal to fire an interrupt so I can only read from the accelerometer when data is ready. Problem is, I don't have any port B pins available because I'm using them for interfacing to an LCD (not serial). Right now, I'm just polling a status register bit in the accelerometer to see when data is available, but this obviously isn't very efficient since I also want to be reading in GPS data and controlling servos at the same time. If there isn't anyway to get an interrupt from any port A or Port C pins, could someone possibly give me another way of synchronizing with my accelerometer using the PIC16F873A?
- This is the poster case for why you need to carefully chose which pins of the micro will be used in what ways. "I'm using them for interfacing to an LCD" is no excuse. Go use some other pins for the LCD that don't also have a special hardware function you need. Assign pins that use special hardware functions first, then assign general I/O to whatever pins are left over.
- The PIC 16F873A is quite old. There are probably newer PICs with the same footprint that have a lot more I/O capability, possibly including more interrupt on change pins.
- There are other ways to cause a interrupt, such as the INT pin specifically for that purpose, the CCP inputs, and even timer clock inputs if you're clever. Some of these may use up other hardware just to get the interrupt, but there is no harm in that if you weren't going to use that hardware anyway.
- See point one. Assign the pins properly. This really should be obvious.