LPC1758 PWM Init

Gast #2586310
Lesenswert?

Moin,

kann mir jmd von euch mit meiner PWM-Initialisierung weiterhelfen? Bis 
jetzt sehe ich leider noch kein PWM-Signal an meinem LPC1758 Prozessor.


Das ist meine Initialiszierung.
1
                  /* Enable PWM1 block */
2
    LPC_SC->PCONP |= (1<<6); 
3
  
4
      /* Configure PWM1_PCLK to CCLK(72MHz), default value is CCLK/4 */
5
      LPC_SC->PCLKSEL0 &= ~(3 << 12);
6
      LPC_SC->PCLKSEL0 |=  (3 << 12);  /* PWM1_PCLK=CCLK/8 */
7
    /* 0 = CCLK/4 | 1 = CCLK | 2 = CCLK/2 | 3 = CCLK/8 */
8

9
    /* Configure  PWM1.6 pin (out-enable pin) */
10
    LPC_PINCON->PINSEL3 &= ~(3UL << 20);
11
      LPC_PINCON->PINSEL3 |=  (2UL << 20);          /* P1.26: PWM1.6 */
12
    
13
    /* Configure Pinmode: neither pull-up nor pull-down -> open-drain output */
14
    LPC_PINCON->PINMODE3 &= ~(3UL << 20);
15
    LPC_PINCON->PINMODE3 |= (2UL << 20);
16

17

18
                  LPC_PWM1->TCR = (1<<1); //--- Reset counter
19
    LPC_PWM1->PR = 0;
20
    LPC_PWM1->PC = 0;
21

22
    LPC_PWM1->MR0 = 1000; //--- test period
23
    LPC_PWM1->MR1 = 800;
24
    LPC_PWM1->MR2 = 700;
25
    LPC_PWM1->MR6 = 500; //--- test period/2
26
    LPC_PWM1->MCR = (1<<1);
27

28
                  LPC_PWM1->TCR |= (1<<0)|(1<<3);  // enable PWM
29
     LPC_PWM1->PCR |= (1<<14);     //--- PWM1.6 output


Gruß
Lars

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren