Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC


Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | Re: How to use HC12's ECT as a general purpose Timer?

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Re: How to use HC12's ECT as a general purpose Timer? - Salvador Tenorio - May 18 13:42:00 2005

You can use the free running counter as your "tick" generator and
configure it to suit your needs (lets say to roll over every 1ms).
When the timer expires have it generate an interrupt.

You can use this interrupt to drive a pretty nice timer task with as
many timers as you wish. If you need long (lets say 500 ms) and
short timers (1ms) you can set two timer channels in the HCS12 to
suit the tick requirements so you don't have to keep globals in your
ISR's.

I have used this method successfully to create a pool of timers,
both long and short. How many of these you will be able to create
will depend on how much ram you are willing to reserve for this
purpose. I have set my pools for 10 timers each, so I have a total
of 20 timers which consume less tan a couple 100 bytes (don't recall
the exact numbers cause I don't have the code here).

If you need HL code examples for the task in C (including examples
of what to do when the interrupt arrives), I can send you something,
just let me know.

Sal.

--- In 68HC12@68HC..., "Amr M. Adel" <amradel_79@h...> wrote:
> Hi all,
> I am a new member in this group. I hope to gain new knowledge and
> share my konwledge with you.
>
> I need to implement a general purpose timer on HC12 microcontroller
> and as U know it is not provided in HC12. ECT, Enhanced Capture
> Timer, is the only thing that can be used for this purpose.
>
> I have an idea to use ECT as a General Purpose Timer. This can be
> achieved by changing the value of the comparator of a channel each
> time a it finishs its period. The main disadvantage of this
technique
> is that periods may be irrigular because of the adjustement of the
> comparator is depending on ISR which may ba masked or delayed!
>
> Any Suggestion or documentation describing how to achieve this?
>
> Thanx for your interest,
> Amr




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: How to use HC12's ECT as a general purpose Timer? - Amr M. Adel - May 22 2:41:00 2005

--- In 68HC12@68HC..., "Salvador Tenorio"
<salvador_tenorio@y...> wrote:
> You can use the free running counter as your "tick" generator and
> configure it to suit your needs (lets say to roll over every 1ms).
> When the timer expires have it generate an interrupt.
>
> You can use this interrupt to drive a pretty nice timer task with
as
> many timers as you wish. If you need long (lets say 500 ms) and
> short timers (1ms) you can set two timer channels in the HCS12 to
> suit the tick requirements so you don't have to keep globals in
your
> ISR's.
>
> I have used this method successfully to create a pool of timers,
> both long and short. How many of these you will be able to create
> will depend on how much ram you are willing to reserve for this
> purpose. I have set my pools for 10 timers each, so I have a total
> of 20 timers which consume less tan a couple 100 bytes (don't
recall
> the exact numbers cause I don't have the code here).
>
> If you need HL code examples for the task in C (including examples
> of what to do when the interrupt arrives), I can send you
something,
> just let me know.
>
> Sal.

Sal,
Sorry for the late reply. I will be so grateful if U send me some
resources regarding this issue.
Thanx alot,

Amr
>
> --- In 68HC12@68HC..., "Amr M. Adel" <amradel_79@h...>
wrote:
> > Hi all,
> > I am a new member in this group. I hope to gain new knowledge and
> > share my konwledge with you.
> >
> > I need to implement a general purpose timer on HC12
microcontroller
> > and as U know it is not provided in HC12. ECT, Enhanced Capture
> > Timer, is the only thing that can be used for this purpose.
> >
> > I have an idea to use ECT as a General Purpose Timer. This can be
> > achieved by changing the value of the comparator of a channel each
> > time a it finishs its period. The main disadvantage of this
> technique
> > is that periods may be irrigular because of the adjustement of the
> > comparator is depending on ISR which may ba masked or delayed!
> >
> > Any Suggestion or documentation describing how to achieve this?
> >
> > Thanx for your interest,
> > Amr




(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )