lpcware

LPC2106 timer0 match interrupt without reset counter not work

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by hydromet on Tue Nov 18 22:49:30 MST 2014
I need periodic interrupts with T0TC from 0 to 0xffffffffL
    PINSEL0_bit.P0_4=2;              // select Pin P0.4 as CAP0.1
  T0TCR = 2;
  T0CTCR = 0; // Set timer counters mode - clock by PCLK
T0PR  = 0;     // Set timer prescaler
T0MR0 = 3600;// Set timer period
  T0MCR = 1;  // Set match action - interrupt by MR0 enable without reset counter
        T0CCR = 0x38;    //Set timer counters mode - clock by CAP0.1 (8 - rising edge, 0x10 - falling edge, 0x20 - interrupt)                                 // 0x38 = (5 << 3) - rising
  T0EMR = 0;
  VICIntSelect &= ~(1<<VIC_TIMER0); 
  VICVectAddr0 = (_U32) Tmr0IntOnMR0_isr;
  VICVectCntl0 = 0x20 | VIC_TIMER0;
  VICIntEnable |= (1<<VIC_TIMER0);
  T0TCR = 1;
....................................................................
__irq __arm void Tmr0IntOnMR0_isr(void){
  if(T0IR_bit.MR0INT){
// clear interrupt flag
T0IR_bit.MR0INT = 1;
    T0MR0 += 3600;
.......................................
  }
  if(T0IR_bit.CR1INT){
T0IR_bit.CR1INT = 1;
   PINSEL0_bit.P0_4=0;               // select Pin P0.4 as GPIO
IODIR_bit.P0_4 = 0;
if(IOPIN_bit.P0_4){
........................................
}
else {
........................................
}
   PINSEL0_bit.P0_4=2;               // select Pin P0.4 as CAP0.1
  }
  VICVectAddr = 0;
}

Outcomes