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?


1 Answer 1


Several issues:

  1. 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.

  2. 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.

  3. 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.

  4. See point one. Assign the pins properly. This really should be obvious.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.