Yahoo Groups archive

Lpc2000

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

Message

Re: [lpc2000] Re: LPC2106 timer problem?

2004-07-03 by h s

Some follow up questions? 
 
1) Have you tried the timer interupt at the IRQ levels?
2) Why do you use the  "else if" condition. As compare to going and possible servicing all of them at same time e.g.. 
 
     ir = T0->IR;
     
     if (ir & 0x01) {
            
     }
 
     if (ir & 0x08) {
 
    }
 
Any reason?
 
Karl Olsen <kro@...> wrote:
--- In lpc2000@yahoogroups.com, h s <h7242004@y...> wrote:
> Has any one been able to successfully run all 4-compare channels of 
timer0 simultaneously (in the match interrupt mode, while the main 
timer0 is free running)? 
> The mode of operations could be such that one match channel is 
reloaded at a period rate. The other channels may be started and 
stopped as needed.  
>  
> I am losing match interrupts. 

I am using the four match interrupts and two capture interrupts on 
the free-running timer 0 in a LPC2114.  It seems to work.
In each of the two cature interrupts, I calculate two times (MRx 
values) where the match interrupts should be called, and enable the 
match interrupts:


void FIQ_Handler (void) __attribute__ ((interrupt("FIQ")));
void FIQ_Handler (void)
{
  int now;
  int ir;

  ir = T0->IR;
  if (ir & 0x01)
  {
    /* Match 0 event */
    /* ... */
    T0->MCR &= ~0x0001;  /* Disable MR0 interrupt */
    T0->IR = 0x01;
  }
  else if (ir & 0x02)
  {
    /* Match 1 event */
    /* ... */
    T0->MCR &= ~0x0008;  /* Disable MR1 interrupt */
    T0->IR = 0x02;
  }
  else if (ir & 0x04)
  {
    /* Match 2 event */
    /* ... */
    T0->MCR &= ~0x0040;  /* Disable MR2 interrupt */
    T0->IR = 0x04;
  }
  else if (ir & 0x08)
  {
    /* Match 3 event */
    /* ... */
    T0->MCR &= ~0x0200;  /* Disable MR3 interrupt */
    T0->IR = 0x08;
  }
  else if (ir & 0x10)
  {
    /* Capture 0 event */
    now = T0->CR0;
    T0->MR0 = now + ...;
    T0->MR2 = now + ...;
    T0->MCR |= 0x0041;  /* Enable MR0 and MR2 interrupts */
    T0->IR = 0x10;
  }
  else if (ir & 0x20)
  {
    /* Capture 1 event */
    now = T0->CR1;
    T0->MR1 = now + ...;
    T0->MR3 = now + ...;
    T0->MCR |= 0x0208;  /* Enable MR1 and MR3 interrupts */
    T0->IR = 0x20;
  }
}



Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/lpc2000/
  
   To unsubscribe from this group, send an email to:
lpc2000-unsubscribe@yahoogroups.com
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



		
---------------------------------
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.

Attachments

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.