The new LPC845 breakout board has 3 onboard LEDs- Red, Green, and Blue. The brightness of these LEDs can be controlled using a PWM signal by changing the duty cycle values for each of them. As this board has an SDK support, I have used the SDK drivers to implement this application.
The SCTimer0 generates the PWM pulse at pins which are assigned as the SCT output pins. I have assigned the PWM output to the Green LED (PIO1_0) in my source code. You can assign the PWM output to be on any other LED by using the inbuilt configuration tool which is explained later.
The source code below shows how to set the duty cycle percentage to increase or decrease the brightness of the assigned LED (here I have set it to 60%)
pwmParam.level = kSCTIMER_HighTrue;
pwmParam.dutyCyclePercent = 60;
/* SCT_OUT2 connect to P1_0 */
SWM_SetMovablePinSelect(SWM0, kSWM_SCT_OUT2, kSWM_PortPin_P1_0);
只有注册用户才能在此添加评论。 如果您已经注册,请登录。 如果您还没有注册,请注册并登录。