example using PWM on LPC1114

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

example using PWM on LPC1114

2,126件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by thinkchip on Sun Mar 28 00:31:22 MST 2010
Hi, I read the thread PWM on LPC114, in this thread show a example in how to use the pwm, I try to maked, but I cant, in my program, I try to move a servo motor with 50Hz, I don´t know the parameters limits in the function

init_timer32PWM(1, period, MATCH3);
        enable_timer32(1);
        setMatch_timer32PWM (1, 3, period/4);


in the variable period, what is the calculate to know the frecuency of 50Hz??
sorry for my bad english, I am new in the NXP family, I usually use microcontroller freescale, thanks
0 件の賞賛
返信
3 返答(返信)

1,312件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rmteo on Sun Mar 28 20:29:03 MST 2010
This is for setting up PWM1 of TIMER16_1.   Period (frequency) is determined by the value of LPC_TMR16B1->MR3 and duty cycle by LPC_TMR16B1->MR1.  PWM output is on PIO1_10.
    LPC_SYSCON->SYSAHBCLKCTRL |= (0b1<<8);    // Enable TIMER16_1 clock
    LPC_IOCON->PIO1_10 = 0b10;        // PIO1_10 IS MAT1 output
    LPC_TMR16B1->MR3 = 1000;          // MR3 = Period
    LPC_TMR16B1->MR1 = 500;            // MR1 = 50% duty cycle
    LPC_TMR16B1->MCR = 0x400;        // MR3 resets timer
    LPC_TMR16B1->PWMC = 0b1010;        // Enable PWM1 and PWM3
    LPC_TMR16B1->TCR = 0b1;            // Enable Timer1
0 件の賞賛
返信

1,312件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by thinkchip on Sun Mar 28 13:44:36 MST 2010
Hi, I try to do something, but still dont work, I don´t know what to do, in mode timer1 interrupt works ok, but when I try to put the PWM doesn't works, :(:(
Its some example where works ok a pwm output??
0 件の賞賛
返信

1,312件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rmteo on Sun Mar 28 08:10:15 MST 2010
Look at the UM.  Pay particular attention to the part highlighted in red.

Quote:
For each timer, a maximum of three-single edge controlled PWM outputs can be selected on the MATn[2:0] outputs. [COLOR=Red][B]One additional match register determines the PWM cycle length.[/B][/COLOR] When a match occurs in any of the other match registers, the PWM output is set to HIGH. The timer is reset by the match register that is configured to set the PWM cycle length. When the timer is reset to zero, all currently HIGH match outputs configured as PWM outputs are cleared.

0 件の賞賛
返信