Jamie Nicol

S12X Pulse Accumulator Troubles

Discussion created by Jamie Nicol on Apr 3, 2012
Latest reply on Apr 4, 2012 by Jamie Nicol

I'm trying to count pulses on an input pin using the pulse accumulator, but it's always saying there have been no pulses. I'm using a MC9S12XEP100. My initialisation code is this:


  TIM_PACTL_PAEN = 1;
  TIM_PACTL_PAMOD = 0;
  TIM_PACTL_PEDGE = 1;
  DDRT_DDRT7 = 0;

 

and I'm inputing a 1kHz square wave into PT7. but TIM_PACNT is always 0.

 

reading through the datasheet I think I read that I should add the code

 

  TIM_TIOS_IOS7 = 1;
  TIM_TCTL1_OM7 = 0;
  TIM_TCTL1_OL7 = 0;
  TIM_OC7M_OC7M7 = 0;

 

but I don't understand why. And it doesn't fix anything anyway.

 

Am I missing something? Thanks in advance.

Outcomes