lpcware

LPC1769 timer question

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by KamingLee on Tue Aug 21 07:38:59 MST 2012
hi! I am new to embedded design, and I want to develop a pulse without affected by other functions, so I read the manual and write my code like this in main:

void InitTIM0 (void)
  {
      LPC_SC->PCONP    |= (1<<1);          // System Control register status, set Timer0 power on
      LPC_SC->PCLKSEL0 |= ((1<<3)|(1<<2)); //Peripheral clock selection for Timer0

      LPC_PINCON->PINSEL7 |=(1<<19)|(0<<18);
      LPC_PINCON->PINMODE7|=(1<<19)|(0<<18);


      LPC_TIM0->TCR = (1<<1);     //Reset the counter
      LPC_TIM0->PR  = 0;          //Reset PR
      LPC_TIM0->PC  = 0;          //Reset PC, when PC= PR {TC +=1, PC=0}, therefore  TC incremented every cycle
      LPC_TIM0->MCR = (1<<1);     //Match control register, TC reset if MR0 matches it

      LPC_TIM0->MR0 = 1000000;
      LPC_TIM0->EMR = (1<<0)|(1<<4)|(1<<5);//external match0, toggle MAT0.0 when matched


      LPC_TIM0->TCR = (1<<0);     //Enables the counting

  }

but it doesn't output anything on P3.25.. any answer will be appreciated!

Outcomes