AnsweredAssumed Answered

S12XE TIM Input Capture Interrupt

Question asked by Ray Hall on Jun 30, 2016
Latest reply on Jul 1, 2016 by Ray Hall

Hello,

 

This project is a traction controller that captures the injector pattern from an external engine management ECU. Then outputs the same pattern or blocks individual injector events based on the level of wheel slip.

 

I am using the TIM input capture to capture both rising and falling edges. I am not capturing the time between edges. I am using six channels. This all works perfectly on engines with sequential fuel injection.  When I tried it on a engine that starts in group fire then switches to sequential it causes loss of control during the group fire mode. In group file the engine management ECU is firing the injectors in three groups. This means two capture interrupts are occurring at the same time.  Below is just two of the interrupts. How do I get them to work correctly.

 

Ray.

 

//------------------------ TIM Input Capture Injector 3 Interrupt --------------------------------

#pragma CODE_SEG NON_BANKED

interrupt 87 void TIM0_INJ3_Isr(void)

{

   uint8_t pinState = PTIP_PTIP2;

 

   TIM_TFLG1 |= TIM_TFLG1_C2F_MASK; // Clear channel 2 flag

 

   PTT_PTT2 = (cal.tc.slipCutPattern[cal.data.cutLevel] >> 2) & pinState;

}

 

#pragma CODE_SEG DEFAULT

 

//------------------------ TIM Input Capture Injector 4 Interrupt --------------------------------

#pragma CODE_SEG NON_BANKED

interrupt 88 void TIM0_INJ4_Isr(void)

{

   uint8_t pinState = PTIP_PTIP3;

 

   TIM_TFLG1 |= TIM_TFLG1_C3F_MASK; // Clear channel 3 flag

 

   PTT_PTT3 = (cal.tc.slipCutPattern[cal.data.cutLevel] >> 3) & pinState;

}

 

#pragma CODE_SEG DEFAULT

Outcomes