lpcware

Clock frequency increase LPC1114

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by zlajoan on Mon May 26 09:41:34 MST 2014
Hi,

i am working with LPC1114 microprocessor and IRC Oscillator as clock. That clock works with 12 MHZ. I have simple program that tests the max output frequency. With code below, I get frequency 120kHZ on pin 0.9. Value in TIME_INTERVAL is max possible for processor to output some values on pin 0.9.

Where If difference between 12 MHZ and 120kHZ (100 times) lost?


int main(void) {
      __disable_irq();

      GPIOInit();
      GPIOSetDir(0, 9, 1);

      init_timer32(0, TIME_INTERVAL);

       enable_timer32(0);

       __enable_irq();

       while(1);

       return 0;
}


#define TIME_INTERVAL(SystemCoreClock / 1000000 - 1)
int status = 1;

void TIMER32_0_IRQHandler(void)
{
  if ( LPC_TMR32B0->IR & 0x01 )
  {
LPC_TMR32B0->IR = 1;/* clear interrupt flag */
timer32_0_counter++;
GPIOSetValue(0, 9, status);
status ^= 1;
  }
  if ( LPC_TMR32B0->IR & (0x1<<4) )
  {
LPC_TMR32B0->IR = 0x1<<4;/* clear interrupt flag */
timer32_0_capture++;
  }
  return;
}


Best regards,
Zlatko

Outcomes