Suggestion of chagnes in sct_pwm.c o LPCOpen

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

Suggestion of chagnes in sct_pwm.c o LPCOpen

481 Views
jeremyhsiao
Contributor II

Hi,

After study PWM example code of LPCOpen 3.0.3 for LPC11U68, it is recommended that some of the value should be updated to avoid confusion. Yes, the function performed as expected but the register setting weren't consistent with  description on comments.

in sct_pwm.c (line 124)

/* Setup match counter 0 for the number of ticks in a PWM sweep, event 0
will be used with the match 0 count to reset the counter. */
LPC_SCT1->MATCH[0].U = cycleTicks;
LPC_SCT1->MATCHREL[0].U = cycleTicks;
LPC_SCT1->EVENT[0].CTRL = 0x00001000;      // ==> suggested to be (1 << 12)
LPC_SCT1->EVENT[0].STATE = 0xFFFFFFFF;   // ==> suggested to be "1" for stateless (ref: 18.6.23 of UM10732)
LPC_SCT1->LIMIT_L = (1 << 0);

(line 181)

/* Don't use states */
LPC_SCT1->STATE_L = 0;                                    // So this is a stateless example

Tags (3)
0 Kudos
1 Reply

427 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Jeremy Hsiao,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
Thanks for your suggestion, I'll submit it to the LPCOpen team.
Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos