ISR FOR MMA8451Q

cancel
Showing results for 
Search instead for 
Did you mean: 

ISR FOR MMA8451Q

194 Views
charanreddy
Contributor III

Hi,

     I have configured the MMA8451Q on KL25Z board and routed the interrupt to INT1. May i know how to write ISR for the INT1 which is connected to PTA14 .

0 Kudos
1 Reply

54 Views
mjbcswitzerland
Specialist V

Hi

You need to configure the PTA14 port as edge sensitive interrupt and then read the latest data.

Attached is a binary file for the FRDM-KL25Z which uses the INT1 output of the MMA8451Q and repeats reading each time data is ready. You can view the interrupt line and the I2C data with an oscilloscope to see that there is an interrupt about every 18ms. (There is a command shell on the OpenSDA virtual COM UART and the accelerator data output can be enabled in the I2C menu so that the values can be seen).

Complete code for this operation for the KL25Z (for CW, KDS, IAR, Keil, Atollic, Rowley Crossworks and GCC) is available at KINETIS Project Code

To build, simply select the define FRDM_KL25Z (in config.h), enable the define IIC_INTERFACE and in iic_tests.h enable TEST_MMA8451Q and INTERRUPT_ON_READY. In case you would like to try INT2 instead, select ACC_USE_INT2. Use the define MMA8451Q_14BIT_RES to choose between 10 and 14 bit resolution.  The project can be run in VisualStudio and the board and accelerometer operation is simulated - see also µTasker Kinetis FRDM-KL25Z support

To do the same on other FRDM or tower boards with the accelerometer just select the corresponding board name instead.

Regards

Mark

µTasker Kinetis support

0 Kudos