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