Clock frequency increase LPC1114

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Clock frequency increase LPC1114

419 次查看
lpcware
NXP Employee
NXP Employee
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
0 项奖励
回复
3 回复数

389 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 26 10:15:17 MST 2014

Quote: zlajoan
So I need to use some faster external clocks to get more frequency?Is there any easier way :) ?



Yes, don't use interrupts , don't use slow pin switching  :)

Clockout:

http://www.lpcware.com/content/forum/changing-the-clock-frecuency-for-the-lpc1227

or PWM  :quest:
0 项奖励
回复

389 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by zlajoan on Mon May 26 10:01:33 MST 2014

Quote: R2D2

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



Code  :O

Believe it or not, MCU is busy with a lot of funny stuff like jump at ISR and return from ISR...

And then it's busy in ISR also, even if you optimize your code...

Therefore it's useful to use faster options to generate a frequency  :)



So I need to use some faster external clocks to get more frequency?
Is there any easier way :) ?
0 项奖励
回复

389 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon May 26 09:56:02 MST 2014

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



Code  :O

Believe it or not, MCU is busy with a lot of funny stuff like jump at ISR and return from ISR...

And then it's busy in ISR also, even if you optimize your code...

Therefore it's useful to use faster options to generate a frequency  :)


0 项奖励
回复