LPC1769 timer question

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

LPC1769 timer question

3,388 Views
lpcware
NXP Employee
NXP Employee
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!
0 Kudos
16 Replies

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jomonthomasnew on Mon Oct 19 06:27:09 MST 2015
The steps involved in configuring a timer in LPC17xx is as follows.
1.Reset the timer by configuring TCR.
2.Set Prescale value in PR
3.Set the count value in Match register(MR)
4.Set appropriate value in MCR.
5.Enable the timer by configuring TCR.
6.Enable timer interrupt if needed.

You can find a good tutorial with the details of registers used for timer programming from the below link.
http://www.techmasterplus.com/tutorials/arm-timer.php
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Sun Aug 26 05:36:59 MST 2012

Quote: Zero
8 1/2 minutes  Much faster than searching my old IR code from last century projects



Was out last two days for work.Thanks a lot zero, I finally finish my design,by "stealing" your idea of interrupt. I finish this by entering the interrupt after every cycle, and count the cycle in the handler, just like your description in the previous post.

Here is my code for an IR controller. Hope will do help to somebody seeking for help as well!

Learn a lot from you. Thank you again!
  

        
#include "lpc17xx_gpio.h"
#include "system_LPC17xx.h"
#include "core_cm3.h"
#include "lpc17xx_pwm.h"

#define FORWARD   0x24
#define BACKWARD  0x12
#define LEFT      0x1
#define RIGHT     0x8

uint32_t F = 22;//Global variables
uint32_t B = 22;//Initialize number of pulses
uint32_t L = 22;
uint32_t R = 22;

//This is used for PWM practicing
void PULSE37500Hz()
{
      LPC_SC->PCONP |= (1 << 6);               //PWM Power on
      LPC_PINCON->PINSEL7 |=(0<<19)|(0<<18);   //Reset output pins P3.25 (19,18bit)
      LPC_PINCON->PINSEL7 |=(1<<19)|(1<<18);   //set pin function to PWM1.2 at P3.25

      LPC_PWM1->TCR = 2;                       //Reset the counter, TCR used for disable/reset TC
      LPC_PWM1->PR = 3;                        //System f=120,000,000 /4=30,000,000Hz, use PR to set PWM to 10MHz
      LPC_PWM1->MCR = (1<<1);                  //Match control register, TC reset if MR0 matches it
      LPC_PWM1->MR0 = 266;                     //set PWM cycle 37.5kHz (26.6)
      LPC_PWM1->MR2 = 133;                     //set duty cycle using channel 2 match register, = 50% (13.3)
      LPC_PWM1->LER = (1<<0)|(1<<2);           //latch MR0 & MR2
      LPC_PWM1->PCR = (1<<10);                 //Enable PWM1 Channel 2 output
      LPC_PWM1->TCR = (1<<0)|(1<<3);           //Enable counter & PWM
}

//This is used for Timer Study
void Init_PULSE10Hz()
{
      LPC_SC->PCONP |= (1 << 1);               //Timer0 Power on
      LPC_PINCON->PINSEL7 |=(0<<21)|(0<<20);   //Reset output pins P3.26 (21,20bit)
      LPC_PINCON->PINSEL7 |=(1<<21)|(0<<20);   //set pin function to MAT0.1 at P3.25

      LPC_TIM0->TCR = 2;                       //Reset the counter (TCR is used for disable/reset TC)
      LPC_TIM0->PR  = 30;                      //System f=120,000,000/4=30,000,000Hz, use PR to set Timer to 1MHz

      LPC_TIM0->MCR |=(1<<4);                   //Match control register, TC reset if MR1 matches it
      LPC_TIM0->EMR = 0;                       //Reset EMR do nothing when TC=MR1
      LPC_TIM0->EMR |= (1<<7)|(1<<6);           //when TC=MR1, toggle on MATx.1(EM1)

      LPC_TIM0->MR1 = 250000;                 //half of the pulse T, toggle at this point
      LPC_TIM0->TCR = (1<<0);                  //Enable counting
}

uint8_t NavigationSM_ModifyPulseLength_ReturnState()
{
    uint8_t STATE = 0;
    uint8_t TEST  = ((~GPIO_ReadValue(2)) & 0x3F);//Test Port2 bit5,4,3,2,1,0

    switch (TEST)
    {
        case (FORWARD):        STATE =(1<<3); break;
        case (BACKWARD):       STATE =(1<<2); break;
        case (LEFT):           STATE =(1<<1); break;
        case (RIGHT):          STATE =(1<<0); break;
        case (FORWARD+LEFT):   STATE =(1<<3)|(1<<1); break;
        case (FORWARD+RIGHT):  STATE =(1<<3)|(1<<0); break;
        case (BACKWARD+LEFT):  STATE =(1<<2)|(1<<1); break;
        case (BACKWARD+RIGHT): STATE =(1<<2)|(1<<0); break;
        default:               STATE = 0;
        }
    return STATE;
}


uint32_t count = 0;  //set up a counter to count the pulse
uint32_t EN    = 1;  //Enable signal use for External Match MAT0.0(P3.25) output

void TIMER0_IRQHandler(void)
{
 uint32_t flag;
 flag = LPC_TIM0->IR;

 uint32_t S = 88; //start - Pulse numbers
 uint32_t C = 44; //car select
 uint32_t G = 40; //Gap

 if (flag & (1 << 1)) //Interrupt flag for match channel 1.
 {
     LPC_TIM0->IR = (1<<1); //reset
     LPC_TIM0->EMR = (1<<1);

     uint8_t TEST  = ((~GPIO_ReadValue(2)) & 0x3F);//Always when interrupt, test Port2 bit5,4,3,2,1,0
     switch (TEST)
     {
         case (FORWARD):  F = 44;break;
         case (BACKWARD): B = 44;break;
         case (LEFT):     L = 44;break;
         case (RIGHT):    R = 44;break;
         case (FORWARD+LEFT):   F = 44; L = 44;break;
         case (FORWARD+RIGHT):  F = 44; R = 44; break;
         case (BACKWARD+LEFT):  B = 44; L = 44;break;
         case (BACKWARD+RIGHT): B = 44; R = 44;break;

         default:F = B = L = R = 22;
             }

     count++; //The MR1 interrupt is entered after every 37.5kHz pulse, "count" used for pulse counting
     if (count == S + G + C + G + R + G + L + G + B + G + F + 3750-1 ) count=0;//One package, approximately 10 Hz
     if (  ((count>S )&&(count<S+G -1)) //Test the counter, during the GAP and the 10Hz delay, the EN is reset to 0.
         ||((count>S + G + C )&&(count<S+G+C+G -1))
         ||((count>S + G + C + G + R )&&(count<S + G + C + G + R + G -1))
         ||((count>S + G + C + G + R + G + L )&&(count<S + G + C + G + R + G + L + G -1))
         ||((count>S + G + C + G + R + G + L + G + B )&&(count<S + G + C + G + R + G + L + G + B + G -1))
         ||((count>S + G + C + G + R + G + L + G + B + G + F )&&(count<S + G + C + G + R + G + L + G + B + G + F + 3750 -1))
        )
          EN = 0;
     else EN = 1;

 }

 if (flag & (1 << 0)) //Interrupt flag for MR0(channel 0)
 {

     LPC_TIM0->IR = (1<<0); //reset
     if (EN)
     LPC_TIM0->EMR = (1<<0);
 }
}

#define TIM0PWR_ON 1
uint32_t OneCycle = 266;                //cycle time * prescaler * clock
uint32_t On_Time    = 133;                //on time

void timer0_init(void)
{
 LPC_PINCON->PINSEL7 |= (2<<18);            //function MAT0.0 P3.25 11->19,18bits
 LPC_SC->PCONP       |= (1 << TIM0PWR_ON);  //turn power for TIMER0 on

 LPC_TIM0->PR  = 3;                      //prescaler set timer to 1MHz
 LPC_TIM0->MR1 = OneCycle-1;            //use MR1 to set cycle
 LPC_TIM0->MR0 = LPC_TIM0->MR1 - On_Time; //match register 0 = off time

 LPC_TIM0->MCR = (1<<0)|(3<<3);            //1<<0 Interrupt on MR0, 3<<3 reset + Interrupt on MR1
 LPC_TIM0->EMR = (1<<4)|(2<<6);            //1<<4 Clears EM0, MAT0.0 cleared. 2<<6 Sets EM1, MAT0.1 Set
 NVIC_EnableIRQ(TIMER0_IRQn);              //Enable timer0 interrupt
 LPC_TIM0->TCR = 1;                        //Enable Timer0
}
 
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Thu Aug 23 16:14:42 MST 2012

Quote: Zero
8 1/2 minutes  Much faster than searching my old IR code from last century projects

//counter values
#define MAX_SEQUENCE 4                    //set number of sequence
volatile uint8_t counter = 0;            //count pulses
volatile uint8_t sequence=0;            //switch sequence
volatile uint8_t pulse[4] = {10,2,4,7}; //values for on/off/on/off...
volatile uint8_t pulse_enable=1;        //flag to switch output

void TIMER0_IRQHandler(void)
{
 uint32_t regval;
 regval = LPC_TIM0->IR;
 if (regval & (1 << 1)) //Interrupt flag for match channel 1.
 {
  LPC_TIM0->IR = (1<<1); //reset
  LPC_TIM0->EMR = (1<<1);
  counter++;                            //count pulse
  if(counter >= pulse[sequence])        //reached counter
  {
   counter =0;                            //reset counter
   sequence++;                            //next sequence
   if(sequence >= MAX_SEQUENCE) sequence = 0;//restart sequence
   pulse_enable = !(sequence % 2);        //set on for sequence = 0,2,4...
  }                                      //end reached counter
 }
 if (regval & (1 << 0)) //Interrupt flag for match channel 0.
 {
  LPC_TIM0->IR = (1<<0); //reset
  if(pulse_enable)                        //if pulse enabled
  {
   LPC_TIM0->EMR = (1<<0);                //switch on
  }
 }
}



You are amazing!!!

I will leave your code for an hour or later, try to do it my self first:D

Great thanks to you!!
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Aug 23 16:09:17 MST 2012

Quote:

it takes you probably less than 10 minutes...

8 1/2 minutes  Much faster than searching my old IR code from last century projects

//counter values
#define MAX_SEQUENCE 4                    //set number of sequence
volatile uint8_t counter = 0;            //count pulses
volatile uint8_t sequence=0;            //switch sequence
volatile uint8_t pulse[4] = {10,2,4,7}; //values for on/off/on/off...
volatile uint8_t pulse_enable=1;        //flag to switch output

void TIMER0_IRQHandler(void)
{
 uint32_t regval;
 regval = LPC_TIM0->IR;
 if (regval & (1 << 1)) //Interrupt flag for match channel 1.
 {
  LPC_TIM0->IR = (1<<1); //reset
  LPC_TIM0->EMR = (1<<1);
  counter++;                            //count pulse
  if(counter >= pulse[sequence])        //reached counter
  {
   counter =0;                            //reset counter
   sequence++;                            //next sequence
   if(sequence >= MAX_SEQUENCE) sequence = 0;//restart sequence
   pulse_enable = !(sequence % 2);        //set on for sequence = 0,2,4...
  }                                      //end reached counter
 }
 if (regval & (1 << 0)) //Interrupt flag for match channel 0.
 {
  LPC_TIM0->IR = (1<<0); //reset
  if(pulse_enable)                        //if pulse enabled
  {
   LPC_TIM0->EMR = (1<<0);                //switch on
  }
 }
}
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Thu Aug 23 15:46:57 MST 2012

Quote: Zero
No :) User manual 10360:
A simple counter with a simple flag will do this job ;)

#1 Count your pulses inside Interrupt handler

#2 If it reaches your desired value reset a flag, which disables just the LPC_TIM0->EMR = ... line.

#3 Load a new counter value which sets the flag again and enables EMR line again...

Changing sample above to pulse counting should require about 10 minutes :eek:



Thanks for your help Zero, it takes you probably less than 10 minutes, but for a noob like me i will need a whole night to test.. I will let you know my progress and probably ask for your help tomorrow morning!:p haha! Thanks a lot!
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Thu Aug 23 15:22:23 MST 2012

Quote:

it seems that you are testing the IR flag and than you set the IR flag again. Dont we need to reset it by 0 instead of 1?

No :) User manual 10360:

Quote:

21.6.1 Interrupt Register (T[0/1/2/3]IR - 0x4000 4000, 0x4000 8000, 0x4009 0000, 0x4009 4000)
The Interrupt Register consists of 4 bits for the match interrupts and 4 bits for the capture interrupts. If an interrupt is generated then the corresponding bit in the IR will be high. Otherwise, the bit will be low. [COLOR=Red]Writing a logic one to the corresponding IR bit will reset the interrupt[/COLOR]. Writing a zero has no effect. The act of clearing an interrupt for a timer match also clears any corresponding DMA request.


Quote:

i try to do something like this:
88x37.5khz pulses -> 40x37.5khz zero(a gap, output nothing)-> 44x37.5khz pulses -> a gap ...

any clue to do this?

A simple counter with a simple flag will do this job ;)

#1 Count your pulses inside Interrupt handler

#2 If it reaches your desired value reset a flag, which disables just the LPC_TIM0->EMR = ... line.

#3 Load a new counter value which sets the flag again and enables EMR line again...

Changing sample above to pulse counting should require about 10 minutes :eek:
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Thu Aug 23 14:58:11 MST 2012

Quote: Zero
You're kidding :)

I've added timer0 IRQ handler in sample above, so with enabled MR0 and MR1 interrupt both edges are triggering their interrupts ;)



Hi Zero! Finally adjust it in my own work, and I am still a little bit confused with this :

void TIMER0_IRQHandler(void) {  uint32_t regval;  regval = LPC_TIM0->IR;  if (regval & (1 << 1)) //Interrupt flag for match channel 1.  {   LPC_TIM0->IR = (1<<1); //reset   LPC_TIM0->EMR = (1<<1);  }  if (regval & (1 << 0)) //Interrupt flag for match channel 0.  {   LPC_TIM0->IR = (1<<0); //reset   LPC_TIM0->EMR = (1<<0);  } }
it seems that you are testing the IR flag and than you set the IR flag again. Dont we need to reset it by 0 instead of 1?

and one more question:

i try to do something like this:
88x37.5khz pulses -> 40x37.5khz zero(a gap, output nothing)-> 44x37.5khz pulses -> a gap ...

any clue to do this? I was thinking about using PWM as an enable signal to control the TIM0. but it only got 6 MR which can only used for 3x double edge processing.

Thank you very much!:)
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Aug 22 13:31:48 MST 2012

Quote: KamingLee
By the way, do you know how can I use the pulse rising edge?



You're kidding :)

I've added timer0 IRQ handler in sample above, so with enabled MR0 and MR1 interrupt both edges are triggering their interrupts ;)
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Wed Aug 22 13:04:59 MST 2012

Quote: Zero
If your PWM is running with 30MHz, your prescaler (30) is reducing that to 1MHz.

Now you are writing 26.6 to MR0. That's not working :mad:

MR0 is a 32bit register, so your float (26.6) is casted to integer (26) and written to MR0 :eek:

So your PWM cycle is 1E6/26 Hz = 38461 Hz (that's 2.6% off)

That your toy is working shows that your toy is very tolerant :)

So a better approach would be to prescale 3 and use MR0=267:

So your PWM cycle is 10E6/267 Hz = 37453 Hz (that's 0.13% off)

I'll look for a timer match sample later when I'm back in my office ;)




Thanks Zero! you are right, if the toy is sensitive i might fail in my way! cheers! Do learn a lot these days! I am currently trying to interpret my code from Verilog HDL to C, to cut the size of my design.

By the way, do you know how can I use the pulse rising edge? I am trying to implement something like:

always @(posedge CLK)begin
....
do something
...
end
in VERILOG,

but I always getting wrong timings.

Thanks again!
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Aug 22 06:39:55 MST 2012
This is a working timer match program (without toggling) :rolleyes:

Note: PR and MR register are using correct counter values (counter starts at zero :eek:)

#define PCTIM0 1

uint32_t cycle_time = 1000;                //cycle time * prescaler * clock
uint32_t on_time    =  250;                //on time

void TIMER0_IRQHandler(void)
{
 uint32_t regval;
 regval = LPC_TIM0->IR;
 if (regval & (1 << 1)) //Interrupt flag for match channel 1.
 {
  LPC_TIM0->IR = (1<<1); //reset
  LPC_TIM0->EMR = (1<<1);
 }
 if (regval & (1 << 0)) //Interrupt flag for match channel 0.
 {
  LPC_TIM0->IR = (1<<0); //reset
  LPC_TIM0->EMR = (1<<0);
 }
}

void timer0_init(void)
{
 LPC_PINCON->PINSEL3 |= (3<<24);        //MAT0.0 P1.28
 LPC_SC->PCONP |= (1 << PCTIM0);        //turn power for TIMER0 on
 LPC_TIM0->PR  = 25-1;                    //(prescaler -1) to 1MHz
 LPC_TIM0->MR1 = cycle_time-1;            //match register 1 = cycle
 LPC_TIM0->MR0 = LPC_TIM0->MR1 - on_time;//match register 0 = off time
 LPC_TIM0->MCR = (1<<0)|(3<<3);            //reset MR1
 LPC_TIM0->EMR = (1<<4)|(2<<6);            //MAT0.0 P1.28
 NVIC_EnableIRQ(TIMER0_IRQn);
 LPC_TIM0->TCR = 1;                        //enable Timer0
}
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Wed Aug 22 05:01:06 MST 2012

Quote: Zero
:confused:

Perhaps you want to rethink that part :rolleyes:  It's not generating 37.5 kHz :eek:



got the timer working as well!

void PULSE0.5Hz()            //This function use PWM to generate the desire frequency
{
      LPC_SC->PCONP |= (1 << 1);               //Timer0 Power on
      LPC_PINCON->PINSEL7 |=(0<<19)|(0<<18);   //Reset output pins P3.25 (19,18bit)
      LPC_PINCON->PINSEL7 |=(1<<19)|(0<<18);   //set pin function to MAT0.0 at P3.25

      LPC_TIM0->TCR = 2;                       //Reset the counter, TCR used for disable/reset TC
      LPC_TIM0->PR  = 30;                      //System f=120,000,000 /4=30,000,000Hz, use PR to set PWM to 1MHz
      LPC_TIM0->MCR =(1<<1);                   //Match control register, TC reset if MR0 matches it
      LPC_TIM0->EMR = 0;
      LPC_TIM0->EMR = (1<<5)|(1<<4);           //toggle (1<<1) EM1, drive the MAT0.1

      LPC_TIM0->MR0 = 1000000;
      LPC_TIM0->TCR = (1<<0);
}:)
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Aug 22 04:55:37 MST 2012
If your PWM is running with 30MHz, your prescaler (30) is reducing that to 1MHz.

Now you are writing 26.6 to MR0. That's not working :mad:

MR0 is a 32bit register, so your float (26.6) is casted to integer (26) and written to MR0 :eek:

So your PWM cycle is 1E6/26 Hz = 38461 Hz (that's 2.6% off)

That your toy is working shows that your toy is very tolerant :)

So a better approach would be to prescale 3 and use MR0=267:

So your PWM cycle is 10E6/267 Hz = 37453 Hz (that's 0.13% off)

I'll look for a timer match sample later when I'm back in my office ;)
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Wed Aug 22 04:25:14 MST 2012

Quote: Zero
:confused:

Perhaps you want to rethink that part :rolleyes:  It's not generating 37.5 kHz :eek:



I have tested this using my remote-controlled toy car, it is 37.5khz coz the car works fine. i checked my cclk and calculated pclk.

but really, thank you so much!

btw, could you please also give me some example for how to use the timer? I tried 2 days for this but can't get anything from the MAT0.1 output port.:(

Cheers!
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Wed Aug 22 03:46:53 MST 2012

Quote: KamingLee

      LPC_PWM1->MR0 = 26.6;   //set PWM cycle 37.5kHz
      LPC_PWM1->MR2 = 13.3;   //set duty cycle using channel 2 match register, = 50%



:confused:

Perhaps you want to rethink that part :rolleyes:  It's not generating 37.5 kHz :eek:
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by KamingLee on Wed Aug 22 03:32:24 MST 2012

Quote: Zero
So PWM?

http://knowledgebase.nxp.com/showthread.php?p=16360




Thanks a lot Zero!
I have changed your code a bit to adapt to my design, and i figured out that i m not using the CMSIS library so my system cclk and pclk is different.
this can be found using the function of CLKPWR_GetPCLK(); in lpc17xx_clkpwr.h

I hope that some people may find this useful!
Thanks again!

void PULSE37500Hz()            //This function use PWM to generate the desire frequency
{
      LPC_SC->PCONP |= (1 << 6);               //PWM Power on
      LPC_PINCON->PINSEL7 |=(0<<19)|(0<<18);   //Reset output pins P3.25 (19,18bit)
      LPC_PINCON->PINSEL7 |=(1<<19)|(1<<18);   //set pin function to PWM1.2 at P3.25

      LPC_PWM1->TCR = 2;                       //Reset the counter, TCR used for disable/reset TC
      LPC_PWM1->PR = 30;                       //System f=120,000,000 /4=30,000,000Hz, use PR to set PWM to 1MHz
      LPC_PWM1->MCR = (1<<1);                  //Match control register, TC reset if MR0 matches it
      LPC_PWM1->MR0 = 26.6;                    //set PWM cycle 37.5kHz
      LPC_PWM1->MR2 = 13.3;                    //set duty cycle using channel 2 match register, = 50%
      LPC_PWM1->LER = (1<<0)|(1<<2);           //latch MR0 & MR2
      LPC_PWM1->PCR = (1<<10);                 //Enable PWM1 Channel 2 output
      LPC_PWM1->TCR = (1<<0)|(1<<3);           //Enable counter & PWM

}
0 Kudos

2,089 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Ex-Zero on Tue Aug 21 08:09:45 MST 2012

Quote: KamingLee
...I want to develop a pulse...



So PWM?

http://knowledgebase.nxp.com/showthread.php?p=16360
0 Kudos