Denis Martins Dantas

Identify interrupt source from Input Capture XORed pins

Discussion created by Denis Martins Dantas on Feb 28, 2018
Latest reply on Mar 9, 2018 by Daniel Martynek

Hi, I'm using the MC9S12ZVM256 MCU. I'm trying to use the input capture with ports PT1, PT2 and PT3 XORed (as explained in chapter 1.13.5.1 of the Datasheet MC9S12ZVM-Family Reference Manual and Datasheet). The difference is that instead of using the MCU to control a BLDC, I'm using it to control two brushed DC motors.

 

I'd like to know if by having the PT1-3 ports XORed would it be possible to identify which pin generated a rising (or following) edge interrupt? Since I'm connecting each motor hall sensor to each of those pins, I need to know which hall signal generated the interrupt.

 

My first attempt was reading the PTT data register inside the interrupt, but it seems that the interrupt service is so fast that the PTT register is not updated in time to make a comparison between last state of the pins and the current state.

 

Best Regards,

 

Denis

Outcomes