Forum: Mikrocontroller und Digitale Elektronik LPC2148 PWM5 läuft nicht


von gast (Gast)


Lesenswert?

Keine Ahnung wiso die PWM5 nicht läuft.
1
  PINSEL0 &= ~(2 << (10));  //clear bits related to P0.21
2
  PINSEL0 |=  (1 << (10));  //connect signal PWM5 to P0.21 (second alternative function)
3
   
4
  PWMPR  = 0x0000;          //set prescale to 0
5
  PWMMCR = 0x0002;          //counter resets on MR0 match (period time)
6
  
7
  PWMMR0 = 5000;   //MR0 = period cycle time
8
  PWMMR5 = 2500;   //MR5 = duty cycle control
9
  
10
  PWMLER |= (1<<0)|(1<<5); //latch new values for MR0 and MR5
11
  
12
  PWMPCR &= ~(1<<5);
13
  PWMPCR |= (1<<13);
14
 
15
  PWMTCR = 0x09;                   //enable PWM and Counter

danke

von Kai F. (k-ozz)


Lesenswert?

PWM5 liegt, wie du richtig geschrieben hast, auf P0.21. Demzugolge ist 
das PINSEL1-Register dafür zuständig.

Es muß also heißen:
PINSEL1 &= ~(2 << 10);
PINSEL1 |= (2 << 10);

von gast (Gast)


Lesenswert?

Danke, einen Blick ins Datenblatt genau übersehen. :-)

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.