Expanding Output Captures an HCS12

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

Expanding Output Captures an HCS12

2,274 Views
khumphri
NXP Employee
NXP Employee

This message contains an entire topic ported from a separate forum. The original message and all replies are in this single message. We have seeded this new forum with selected information that we expect will be of value to you as you search for answers to your questions.

 

Posted: Sat Jul 23, 2005  6:37 pm

 

Hi All,

 

Has anyone ever used an HCS12 and needed more than the 8 IC/OC Timer channels ?

 

I've a slight problem where I need 10. (2 input & 8 output)

 

I'm thinking of either using an external device (a GAL possibly) to expand a couple of the channels. Or, use the software side of the Output Compare, but then in the ISR code, operate a GPIO pin depending on which one I want to operate. In theory, that way I can have as many Output Capture as I want.....

 

However, I've a feeling that this may introduce latency in the change of state on the pin. Now if this is a constant, I can code it out (by causing the OC event to trigger before I need it to), but if it's variable as I suspect it might be, than that's no good.

 

Anyone any thoughts on this, before I write a load of code only to find it all a waste of time !

 

Thanks

 


 

Posted: Mon Jul 25, 2005  6:33 pm

 

Depending on the demands of your application, there may be an easy way to free up several timer pins.

 

If your application can handle it, you may want to consider conserving your timer pins by using a latching device like a 74HC273 or 47HC374. Just tie any port pins to the data inputs and take one timer pin to the CLK. This way you can use one OC pin tied to the CLK pin to accurately time the transitions of multiple outputs. You can select the next state at any time by setting the port pins. An ideal application would be where the next output state can be determined in the OC interrupt service routine just after the transition.

 


 

Posted: Wed Jul 27, 2005  8:55 am

 

There are HCS12 derivatives with more timer channels. The MC9S12E family has 3 timer independent modules each contains 4 IC/OC channels - for a total of 12 channels.

 

The MC9S12XDP512 (the new S12X device) has 8 channels EC/OC Enhanced-Capture-Timer, plus 4 individual Periodic interrupt timers.

 

Hope this helps,

 


 

Posted: Thu Jul 28, 2005  1:59 am

 

I too have need for more IC/OCs that the 8 on the DP256 I have been using.

 

The S12E family look appealing with 12 IC/OCs (though 16 would be fantastic!!), but without having used this device, can anyone comment on the ability to get these 12 channels working on a synchronized clock. I realize that you could reset the timers for each timer module as close together as you can, and put up with the latency in between them, but ideally it would be good if you can get them to all run an identically synchronized clock for what I am trying to do... is this possible with this device.

 

It would be fantastic if Motorola would release a 16 bit low cost processor with 16 synchronized IC/OCs.

 


 

Posted: Thu Jul 28, 2005  12:17 pm

 

I personally don't have experience with synchronizing the 3 independent timers of the MC9S12E128 to each other.

 

Perhaps you can achieve this by carefully timing your timers initialization routine as follows:

 

First you calculate (using the detailed cycle by cycle information) or measure the time your code take to execute between the starting point of Timer1 and Timer2, and between the starting point of Timer2 and Timer3. Then in your code you can initialize different initial values to the 3 timers, to compensate for the difference in their counting starting point. Theoretically, this should allow you to completely synchronize all 3 timers to each other, to create the effect of one 12 channel IC/OC timer. I am not a big expert of the timers, but you can get the general idea.

 

Maybe there is even an easier way - I haven't checked the MC9S12E128 data sheets carefully to check this.

 

Hope this helps,

Labels (1)
0 Kudos
0 Replies