Input capture LPC1114

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Input capture LPC1114

870 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by thinkchip on Fri Mar 19 23:46:35 MST 2010
Hi, anyone have example in how to use the timer input? I want to know about a frecuency that generated for my sensor, thanks, best regards, sorry for my bad english
0 Kudos
11 Replies

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Fri Apr 20 23:11:37 MST 2012
@Gohai:-  Hi..!!!

Is that code working now.....!!
Thanks & Regards...:)
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by researchinnovation on Wed Apr 11 03:05:48 MST 2012
[SIZE=4][B][COLOR=Blue]Hi...!!!
I want to take/read file(.txt format doc format) continuously as an input for one of my application on I2C.
But when I use FILE *file and file =fopen("filename.txt","r"); it is  showing error and I tried few more things but it is showing error.
I have used #include "debug_printf.h" , #include "stdlib.h" and other required driver files, but still error is coming.

Please guide me on this or share any document available on c functions for LPCxpresso.

Thanks....:)
[/COLOR][/B][/SIZE]
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by galih on Sun Apr 08 00:14:06 MST 2012
Hi, all. How to calculate Timer16 Prescale value and MR0 value to get 1 second (from start until interrupt)?
Thanks.
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Sat Apr 07 09:21:03 MST 2012
Try #4 of http://knowledgebase.nxp.com/showthread.php?t=2815
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by galih on Sat Apr 07 09:12:34 MST 2012
Hi, I.m newbie and confused about reading timer/counter data. Anyone have tutorial or example about it?

Thanks.
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gohai on Wed Dec 01 00:06:47 MST 2010

Quote: Luis Digital
Hello NXP,

I tried to use your example without success.

You initialized "Timer32", but then uses "Timer16".

I have the following code (main.c):
int main(void) {
 
    init_timer32(0, TIME_INTERVAL);
    enable_timer32(0);
 
 // (bit 1: rising, bit 2: falling, bit 3: Int)
    LPC_TMR32B0->CCR = 0x07;
 
 
    // Enter an infinite loop
 
    while(1) {
 
    }
    return 0 ;
}
timer32.c

  volatile uint32_t count_value;
 
void TIMER32_0_IRQHandler(void)
{  
  LPC_TMR32B0->IR = 1;            /* clear interrupt flag */
    /*In the timer interrupt handler, readout the timer capure register (like CR0) and use that value to calculate the frequency.
    Make sure you reset the TC.
    */
 
      LPC_TMR32B0->IR = 1<<4;            /* clear interrupt flag */
      count_value = LPC_TMR32B0->CR0;
      LPC_TMR32B0->TCR = 1<<1;
 
  timer32_0_counter++;
  return;
}
A change in PIO1_5/RTS/CT32B0_CAP0 pin generates an interrupt, but the CR0 register is always equal to 0.

You could show a more elaborate example (for newbies:))?
---

I think the IDE has some problems displaying records:
TCR should have 2 bits, not just one.
CR0 not present in Timer32 (TIMER0).
[IMG]http://img339.imageshack.us/img339/613/timercr0.jpg[/IMG]

Thanks in advance.




Could you tell me how to solve the problem "the CR0 register is always equal to 0"?
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gohai on Fri Oct 22 00:09:59 MST 2010

Quote: thinkchip
Hi, anyone have example in how to use the timer input? I want to know about a frecuency that generated for my sensor, thanks, best regards, sorry for my bad english



could you stick the content of function init_timer32 ?
I have the same problem, thx!
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Sun Mar 28 08:17:25 MST 2010
I corrected an error in my previous comment, thanks to CoAssistant.

These people are doing a great job, and best of all is that the tools are free to use, and without registration or restriction.
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by CodeRedSupport on Sat Mar 27 01:12:19 MST 2010
Hi,

Thanks for your report on the TIMER32 peripheral display, which we have fixed and will be available in the next release.
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Luis Digital on Fri Mar 26 15:53:56 MST 2010
Hello NXP,

I tried to use your example without success.

You initialized "Timer32", but then uses "Timer16".

I have the following code (main.c):
int main(void) {

    init_timer32(0, TIME_INTERVAL);
    enable_timer32(0);

 // (bit 1: rising, bit 2: falling, bit 3: Int)
    LPC_TMR32B0->CCR = 0x07;


    // Enter an infinite loop

    while(1) {

    }
    return 0 ;
}
timer32.c

  volatile uint32_t count_value;

void TIMER32_0_IRQHandler(void)
{  
  LPC_TMR32B0->IR = 1;            /* clear interrupt flag */
    /*In the timer interrupt handler, readout the timer capure register (like CR0) and use that value to calculate the frequency.
    Make sure you reset the TC.
    */

      LPC_TMR32B0->IR = 1<<4;            /* clear interrupt flag */
      count_value = LPC_TMR32B0->CR0;
      LPC_TMR32B0->TCR = 1<<1;

  timer32_0_counter++;
  return;
}
A change in PIO1_5/RTS/CT32B0_CAP0 pin generates an interrupt, but the CR0 register is always equal to 0.

You could show a more elaborate example (for newbies:))?
---

I think the IDE has some problems displaying records:
TCR should have 2 bits, not just one.
CR0 not present in Timer32 (TIMER0).
[IMG]http://img339.imageshack.us/img339/613/timercr0.jpg[/IMG]

Thanks in advance.
0 Kudos

622 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by NXP_Europe on Thu Mar 25 06:37:28 MST 2010
Hi Thinkchip,
If you'd like to measure a frequency on a capture pin, you'd like to setup the timer to run much faster then the expected sensor output frequency. If you use the timer as like in the blinky example, it runs at 48 MHz.
The overflow value (TIME_INTERVAL) must be much higher then the expected timer counter value at the measured frequency
like:
init_timer32(0, TIME_INTERVAL);
Set the capture input to react on the rising, falling or both edges and enable the interupt.
    /* Capture on both edges (so the half period)
     * and enable the interrupt 
     */
    LPC_TMR16B0->CCR = 0x07;
In the timer interrupt handler, readout the timer capure register (like CR0) and use that value to calculate the frequency.
Make sure you reset the TC.
  LPC_TMR16B0->IR = 1<<4;            /* clear interrupt flag */
  count_value = LPC_TMR16B0->CR0;
  LPC_TMR16B0->TCR = 1<<1;


Hope this helps you!
0 Kudos