Pulse Accumulator B Help

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Pulse Accumulator B Help

3,434 Views
Bernie
Contributor I
Hi Everyone,
I have an application where I want to read two independent sets of pulses into the 9S12A256B microcontroller (HCS12).
I know that there is two 16bit pulse accumulators, and I have Pulse Accumulator A working fine. But I want Pulse Accumulator B to work the same way: to count pulse events and store the counts in the 16bit register. I thought I had things set up properly to do this but there's no documentation that I could find that says how the PA-B actually registers pulses. I have my pulse input (for PA-B) hooked up to pin 5 (PT0). My Pulse Accumulator A is initialized like this:
Code:
void PAA_Init(void){ PAEN = 1;               // 16 bit pulse accumulator A system enabled. PAMOD = 0;              // set to "event counter" mode PEDGE = 1;              // rising edge  CLK1 = 0;    // not sure why this is zero CLK0 = 0;               // not sure why this is zero PAOVI = 1;              // interrupt if PAOVF os set PAI = 0;                // don't want an interrupt every time there's a pulse on PA}

 
And Pulse Accumulator B is initialized:
Code:
void Flow_Init(void){ PBEN = 1;               // 16 bit pulse accumulator B system enabled. PB0VI = 1;              // interrupt if PBOVF is set}

 
Anyone know how to set this up?
 
Bernie
 
(Alban highlighted the code)

Message Edited by Alban on 02-06-2006 09:19 AM

Labels (1)
0 Kudos
1 Reply

525 Views
Bernie
Contributor I

Seems that I forgot to set the bits in TCTL4 that set the input edge detect for pulse accumulator B. I want to capture on the rising edge, so I set EDG0A = 1;

Now it works properly. It was in a bit of an obscure location so I couldn't find it right away.

Thanks anyway,

Bernie

0 Kudos