Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[ARM] single edge PWM in LPC2138

Status
Not open for further replies.

eric_s88

Newbie level 4
Joined
Nov 19, 2013
Messages
7
Helped
1
Reputation
2
Reaction score
1
Trophy points
3
Activity points
56
Hi everyone! happy to joined you in this forum :wink:

I want to have 2 single edge pwm (pwm6 and pwm1) in outputs of lpc2138. but I don't know why I have only one pwm signal!! I mean when I activate them only 1 output generate the signal. I want 2 signals that are inverted and non-inverted :( whats wrong with the code ?
I use IAR as compiler.

in its library I have:
Code:
void pwm6_init(void)
{
  PWMPR=0x00000DFF;
  PWMPCR|=(1<<14);
  PWMMR0=0x000000FF;
  PWMMCR=0x00000002;
  PWMTCR=0x00000002;
  PWMTCR=0x00000009;
  PINSEL0|=(1<<19);
}

void pwm6_out(us32 value)
{
  PWMMR6=value;
  PWMLER=64;
}

void pwm1_init(void)
{
  PWMPR=0x000003FF;
  PWMPCR|=(1<<9);
  PWMMR0=0x000000FF;
  PWMMCR=0x00000002;
  PWMTCR=0x00000002;
  PWMTCR=0x00000009;
  PINSEL0|=(1<<1);
}

void pwm1_out(us32 value)
{
  PWMMR1=value;
  PWMLER=2;
}

and in the main.c

Code:
void main (void)
{
 pwm1_init();
 pwm1_out(127);

 pwm6_init();
  pwm6_out(230);

  while(1)
  {
  



  }



}
 

hi again. I found the problem. it was the PWMLER register that I did not set correct.

another question. I want one of this 2 signals, be inverted (starts with 0 value) .. which register would do that for me?
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top