EmbeddedRelated.com
Forums
Memfault State of IoT Report

LPC2378 timer0

Started by sukh...@yahoo.co.in June 24, 2009
--- In l..., sukhdeep singh wrote:
> can we not make the make high after match?
>
Yes you can, just set the function to Toggle instead of setting it to clear on match. If you select the correct reg.setting, the pin will toggle on match like so:

assume initial state == high

Match 1: pin becomes low
Match 2: pin becomes high again
Match 3: pin becomes low again

to do so set T0MR bits 4 and 5 to 1 (see below).

Table 468. External Match Control (from user manual):
Bits: Description/function
00 Do nothing
01 Clear the corresponding External Match bit/output to 0
(MATn.m pin is LOW if pinned out).
10 Set the corresponding External Match bit/output to 0
(MATn.m pin is HIGH if pinned out).
11 Toggle the corresponding External Match bit/output.

An Engineer's Guide to the LPC2100 Series

Hi:
Why don't you try with setting the Toggle function instead?

T0EMR |= (1 << 5)|(1 << 4);

This way the bit will toggle from high to low (or low to high) every match.

Regards,

Alex
--- In l..., sukhdeep singh wrote:
>
> first of all thanks,
> can we not make the make high after match?
>
> --- On Wed, 24/6/09, Alex Ribero wrote:
>
> From: Alex Ribero
> Subject: [lpc2000] Re: LPC2378 timer0
> To: l...
> Date: Wednesday, 24 June, 2009, 9:19 AM
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Hi:
>
>
>
> This simply indicates that the bit EM0 will go LOW when the match occurs..
>
>
>
> For example
>
>
>
> T0EMR |= (1 << 4);
>
>
>
> will program the Timer 0 to Clear the EM0 bit (on that same register T0EMR) when a match event occurs (TC=MR0).
>
>
>
> If you choose to connect the Match Pin out (to a GPIO using the PINCONNECT registers), then the GPIO will go low.
>
>
>
> Note that if you want to have an actual clock signal, you would need to use the Toggle function or set manually back the bit to 1.
>
>
>
> Regards,
>
>
>
> Alex
>
>
>
> --- In lpc2000@yahoogroups .com, sukhdeep singh wrote:
>
> >
>
> > thanks,
>
> >
>
> > what is the roll of lear the corresponding External
>
> >
>
> > >
>
> >
>
> > > > Match bit/output to 0 (MATn.m pin is
>
> >
>
> > >
>
> >
>
> > > > >LOW if pinned out).
>
> >
>
> > where will we use it in programming.
>
> > Thanks
>
> >
>
> > --- On Wed, 24/6/09, Alex Ribero wrote:
>
> >
>
> > From: Alex Ribero
>
> > Subject: [lpc2000] Re: LPC2378 timer0
>
> > To: lpc2000@yahoogroups .com
>
> > Date: Wednesday, 24 June, 2009, 6:00 AM
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > Hi:
>
> >
>
> >
>
> >
>
> > I would recommend using the PWM module instead of Timer 0.
>
> >
>
> >
>
> >
>
> > The reason for this is that at 4.8MHz, you only have ~208ns between edges. This corresponds to approximately 16 CPU clock cycles, which probably is not enough to execute an interrupt and reload the Timer Match register for the next cycle.
>
> >
>
> >
>
> >
>
> > With the PWM, all functions are done by hardware, and, once setup, there is no need to do anything in software to keep the generated signal running..
>
> >
>
> >
>
> >
>
> > Regards,
>
> >
>
> >
>
> >
>
> > Alex.
>
> >
>
> >
>
> >
>
> > --- In lpc2000@yahoogroups .com, sukhdeep singh wrote:
>
> >
>
> > >
>
> >
>
> > > it's neliz_x's example working fine. there is no problem. but want to generate frequency using Clear the corresponding External
>
> >
>
> > >
>
> >
>
> > > > Match bit/output to 0 (MATn.m pin is
>
> >
>
> > >
>
> >
>
> > > > >LOW if pinned out).
>
> >
>
> > >
>
> >
>
> > > i am failed to generate, output value is not set on timer overflow. how can i set output value after comparsion match occur to generate frequency..
>
> >
>
> > >
>
> >
>
> > > kindly help me.
>
> >
>
> > > Thanks to all of u for ur replies.
>
> >
>
> > >
>
> >
>
> > > --- On Wed, 24/6/09, tike64@ wrote:
>
> >
>
> > >
>
> >
>
> > > From: tike64@
>
> >
>
> > > Subject: [lpc2000] Re: LPC2378 timer0
>
> >
>
> > > To: lpc2000@yahoogroups .com
>
> >
>
> > > Date: Wednesday, 24 June, 2009, 2:52 AM
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > sukhdeep singh wrote:
>
> >
>
> > >
>
> >
>
> > > > second thing, i am not able to generate 4.8Mhz clock using 72Mhz timer..
>
> >
>
> > >
>
> >
>
> > > > can u send me its routine.
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > one more thing, i am not able to use Clear the corresponding External
>
> >
>
> > >
>
> >
>
> > > > Match bit/output to 0 (MATn.m pin is
>
> >
>
> > >
>
> >
>
> > > >
>
> >
>
> > >
>
> >
>
> > > > >LOW if pinned out).
>
> >
>
> > >
>
> >
>
> > > > can i use this to generate frequency. if yes, then how?
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > So, what was wrong with the neliz_x's ideas? How did you try them? What
>
> >
>
> > >
>
> >
>
> > > did happen?
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > --
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > Timo
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > > ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket. yahoo.com
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> > >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> > ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket. yahoo.com
>
> >
>
> >
>
> >
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket.yahoo.com
>
>
>

i am asking, because why they have provided this function in LPC2378. i am not able to understand what will its benefit. i am just completing the requirement. i want to learn it whole.

kindly can u tell me.
Thanks

--- On Thu, 25/6/09, Alex Ribero wrote:

From: Alex Ribero
Subject: [lpc2000] Re: LPC2378 timer0
To: l...
Date: Thursday, 25 June, 2009, 6:18 AM





Hi:

Why don't you try with setting the Toggle function instead?

T0EMR |= (1 << 5)|(1 << 4);

This way the bit will toggle from high to low (or low to high) every match.

Regards,

Alex

--- In lpc2000@yahoogroups .com, sukhdeep singh wrote:

>

> first of all thanks,

> can we not make the make high after match?

>

> --- On Wed, 24/6/09, Alex Ribero wrote:

>

> From: Alex Ribero

> Subject: [lpc2000] Re: LPC2378 timer0

> To: lpc2000@yahoogroups .com

> Date: Wednesday, 24 June, 2009, 9:19 AM

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

> Hi:

>

>

>

> This simply indicates that the bit EM0 will go LOW when the match occurs..

>

>

>

> For example

>

>

>

> T0EMR |= (1 << 4);

>

>

>

> will program the Timer 0 to Clear the EM0 bit (on that same register T0EMR) when a match event occurs (TC=MR0).

>

>

>

> If you choose to connect the Match Pin out (to a GPIO using the PINCONNECT registers), then the GPIO will go low.

>

>

>

> Note that if you want to have an actual clock signal, you would need to use the Toggle function or set manually back the bit to 1.

>

>

>

> Regards,

>

>

>

> Alex

>

>

>

> --- In lpc2000@yahoogroups .com, sukhdeep singh wrote:

>

> >

>

> > thanks,

>

> >

>

> > what is the roll of lear the corresponding External

>

> >

>

> > >

>

> >

>

> > > > Match bit/output to 0 (MATn.m pin is

>

> >

>

> > >

>

> >

>

> > > > >LOW if pinned out).

>

> >

>

> > where will we use it in programming.

>

> > Thanks

>

> >

>

> > --- On Wed, 24/6/09, Alex Ribero wrote:

>

> >

>

> > From: Alex Ribero

>

> > Subject: [lpc2000] Re: LPC2378 timer0

>

> > To: lpc2000@yahoogroups .com

>

> > Date: Wednesday, 24 June, 2009, 6:00 AM

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> > Hi:

>

> >

>

> >

>

> >

>

> > I would recommend using the PWM module instead of Timer 0.

>

> >

>

> >

>

> >

>

> > The reason for this is that at 4.8MHz, you only have ~208ns between edges. This corresponds to approximately 16 CPU clock cycles, which probably is not enough to execute an interrupt and reload the Timer Match register for the next cycle.

>

> >

>

> >

>

> >

>

> > With the PWM, all functions are done by hardware, and, once setup, there is no need to do anything in software to keep the generated signal running..

>

> >

>

> >

>

> >

>

> > Regards,

>

> >

>

> >

>

> >

>

> > Alex.

>

> >

>

> >

>

> >

>

> > --- In lpc2000@yahoogroups .com, sukhdeep singh wrote:

>

> >

>

> > >

>

> >

>

> > > it's neliz_x's example working fine. there is no problem. but want to generate frequency using Clear the corresponding External

>

> >

>

> > >

>

> >

>

> > > > Match bit/output to 0 (MATn.m pin is

>

> >

>

> > >

>

> >

>

> > > > >LOW if pinned out).

>

> >

>

> > >

>

> >

>

> > > i am failed to generate, output value is not set on timer overflow.. how can i set output value after comparsion match occur to generate frequency..

>

> >

>

> > >

>

> >

>

> > > kindly help me.

>

> >

>

> > > Thanks to all of u for ur replies.

>

> >

>

> > >

>

> >

>

> > > --- On Wed, 24/6/09, tike64@ wrote:

>

> >

>

> > >

>

> >

>

> > > From: tike64@

>

> >

>

> > > Subject: [lpc2000] Re: LPC2378 timer0

>

> >

>

> > > To: lpc2000@yahoogroups .com

>

> >

>

> > > Date: Wednesday, 24 June, 2009, 2:52 AM

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > > sukhdeep singh wrote:

>

> >

>

> > >

>

> >

>

> > > > second thing, i am not able to generate 4.8Mhz clock using 72Mhz timer..

>

> >

>

> > >

>

> >

>

> > > > can u send me its routine.

>

> >

>

> > >

>

> >

>

> > > >

>

> >

>

> > >

>

> >

>

> > > > one more thing, i am not able to use Clear the corresponding External

>

> >

>

> > >

>

> >

>

> > > > Match bit/output to 0 (MATn.m pin is

>

> >

>

> > >

>

> >

>

> > > >

>

> >

>

> > >

>

> >

>

> > > > >LOW if pinned out).

>

> >

>

> > >

>

> >

>

> > > > can i use this to generate frequency. if yes, then how?

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > > So, what was wrong with the neliz_x's ideas? How did you try them? What

>

> >

>

> > >

>

> >

>

> > > did happen?

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > > --

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > > Timo

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > > ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket. yahoo.com

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> > >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> >

>

> > ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket. yahoo.com

>

> >

>

> >

>

> >

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

>

> ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket. yahoo.com

>

>

>















ICC World Twenty20 England '09 exclusively on YAHOO! CRICKET http://cricket.yahoo.com



sukhdeep singh wrote:
> i am asking, because why they have provided this function in LPC2378. i
> am not able to understand what will its benefit. i am just completing
> the requirement. i want to learn it whole.

For a fictious example you could imagine an ignition controller. You
could capture an exact time label of specific cranksaft angle with
capture input. Then you could calculate an exact time for the spark and
want the match output change state exactly at that moment.

--

Timo


Memfault State of IoT Report