Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

How Can I Configure Timer? -To get this

How Can I Configure Timer? -To get this

2006-03-25 by Saravanakumar S

Hi all,
        I am newbie to this  field .Can you please help me to come out of 
this problem.

        I modify the pgm, to generate the 100KHz frequency with 50% duty 
cycle  in Timer1 Match 1.1 pin(P0.13 pin)

The modified program is generate correct frequency in polling method 
only.It didnt generate the frequency (50% duty cycle) While performing 
other tasks.

I want to generate the frequency(50% duty cycle),with out polling method.

Give me some ideas,to generate the 100KHz frequency(50% duty cycle) in any 
method.

Herewith this i  enclosed my program.

#include <LPC210x.H> 

void T0isr(void)        __irq;

void main(void)
{
        VPBDIV = 0x00000000;            // Configure the  VPB divi
        PINSEL0 |= 0x08000000;          //Match1 as output      (P0.13)
        T1PR = 0;                                       //Load prescaler
        T1TCR = 0x00000002;                     //Reset timer
        T1MR1 = 0x00000048;                     // Set the on or off time 
of cycle 
        T1MCR = 0x00000018;                     //Reset on MR1 & interrupt 
On MR1
 
        VICVectAddr4 = (unsigned)T0isr; //Set the timer ISR vector address
        VICVectCntl4 = 0x00000025;      //Set channel
        VICIntEnable |= 0x0000020;      //Enable the interrupt
        T1TCR           = 0x00000001;   //enable timer
        while (1)
        {
                ;
        }
}

void T0isr (void)       __irq
{
        T1EMR |= 0x000000C2;            /Toggle MAT1 pin
        T1IR |= 0x00000002;             //Clear match 1 interrupt
        VICVectAddr = 0x00000000;       //Dummy write to signal end of 
interrupt
}


[Non-text portions of this message have been removed]

Re: How Can I Configure Timer? -To get this

2006-03-25 by fordp2002

50% duty cycle is a special case that is super easy to produce.

Heres how to do it.

1) Choose a Timer any timer.
2) Program a Match register to a suitable value for the time you want.
3) Program that same regiter to toggle its output pin and reset the time.
4) Start the timer at zero.

Thats it, no interrupts are needed.

I guess others would say to use the PWM feature, but I have not read
that bit.

Good Luck!



--- In lpc2000@yahoogroups.com, "Saravanakumar S"
<Saravanakumar.S@...> wrote:
>
> Hi all,
>         I am newbie to this  field .Can you please help me to come
out of 
> this problem.
> 
>         I modify the pgm, to generate the 100KHz frequency with 50%
duty 
> cycle  in Timer1 Match 1.1 pin(P0.13 pin)
> 
> The modified program is generate correct frequency in polling method 
> only.It didnt generate the frequency (50% duty cycle) While performing 
> other tasks.
> 
> I want to generate the frequency(50% duty cycle),with out polling
method.
> 
> Give me some ideas,to generate the 100KHz frequency(50% duty cycle)
in any 
> method.
> 
> Herewith this i  enclosed my program.
> 
> #include <LPC210x.H> 
> 
> void T0isr(void)        __irq;
> 
> void main(void)
> {
>         VPBDIV = 0x00000000;            // Configure the  VPB divi
>         PINSEL0 |= 0x08000000;          //Match1 as output      (P0.13)
>         T1PR = 0;                                       //Load prescaler
>         T1TCR = 0x00000002;                     //Reset timer
>         T1MR1 = 0x00000048;                     // Set the on or off
time 
> of cycle 
>         T1MCR = 0x00000018;                     //Reset on MR1 &
interrupt 
> On MR1
>  
>         VICVectAddr4 = (unsigned)T0isr; //Set the timer ISR vector
address
Show quoted textHide quoted text
>         VICVectCntl4 = 0x00000025;      //Set channel
>         VICIntEnable |= 0x0000020;      //Enable the interrupt
>         T1TCR           = 0x00000001;   //enable timer
>         while (1)
>         {
>                 ;
>         }
> }
> 
> void T0isr (void)       __irq
> {
>         T1EMR |= 0x000000C2;            /Toggle MAT1 pin
>         T1IR |= 0x00000002;             //Clear match 1 interrupt
>         VICVectAddr = 0x00000000;       //Dummy write to signal end of 
> interrupt
> }
> 
> 
> [Non-text portions of this message have been removed]
>

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.