2013-02-18 15:32:11 +00:00
|
|
|
#include "test_env.h"
|
|
|
|
|
|
|
|
/* Timer/Match Register Pinout Options
|
|
|
|
|
|
|
|
CT16B0/MR0 p5 (P0_9)
|
|
|
|
CT16B0/MR1 p6 (P0_8)
|
|
|
|
CT16B0/MR2 p34 (P1_15)
|
|
|
|
|
|
|
|
CT16B1/MR0 p36 (P0_21)
|
|
|
|
CT16B1/MR1 p20 (P0_22) and p14 (P1_23)
|
|
|
|
|
|
|
|
CT32B0/MR0 p25 (P1_24)
|
|
|
|
CT32B0/MR1 p26 (P1_25) and USBTX (P0_19)
|
|
|
|
CT32B0/MR2 p10 (P1_26)
|
|
|
|
*/
|
|
|
|
|
|
|
|
int main() {
|
2013-05-16 06:53:02 +00:00
|
|
|
#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24) || defined(TARGET_LPC4088)
|
2013-02-18 15:32:11 +00:00
|
|
|
PwmOut pwm_p25(p25);
|
|
|
|
PwmOut pwm_p26(p26);
|
2013-06-27 21:20:47 +00:00
|
|
|
|
2013-02-18 15:32:11 +00:00
|
|
|
pwm_p25.write(0.75);
|
|
|
|
pwm_p26.write(0.50);
|
2013-06-27 21:20:47 +00:00
|
|
|
|
2013-02-18 15:32:11 +00:00
|
|
|
printf("Initialize PWM on pin 25 with duty cycle: %.2f\n", pwm_p25.read());
|
|
|
|
printf("Initialize PWM on pin 26 with duty cycle: %.2f\n", pwm_p26.read());
|
2013-02-26 14:57:42 +00:00
|
|
|
|
2013-07-26 09:12:49 +00:00
|
|
|
#elif defined(TARGET_LPC1114)
|
2013-09-09 09:15:51 +00:00
|
|
|
PwmOut pwm_dp24(dp24); // P0_1
|
|
|
|
PwmOut pwm_dp18(dp18); // P1_9
|
2013-07-26 09:12:49 +00:00
|
|
|
|
2013-09-09 09:15:51 +00:00
|
|
|
pwm_dp24.write(0.75);
|
|
|
|
pwm_dp18.write(0.50);
|
2013-07-26 09:12:49 +00:00
|
|
|
|
2013-09-09 09:15:51 +00:00
|
|
|
printf("Initialize PWM on pin 24 with duty cycle: %.2f\n", pwm_dp24.read());
|
|
|
|
printf("Initialize PWM on pin 18 with duty cycle: %.2f\n", pwm_dp18.read());
|
2013-07-26 09:12:49 +00:00
|
|
|
|
2013-02-26 14:57:42 +00:00
|
|
|
#elif defined(TARGET_KL25Z)
|
|
|
|
PwmOut pwm_d2(D2);
|
2013-06-27 21:20:47 +00:00
|
|
|
|
|
|
|
pwm_d2.period_ms(10);
|
|
|
|
pwm_d2.write(0.75);
|
|
|
|
printf("%.2f\n", pwm_d2.read());
|
|
|
|
|
|
|
|
#elif defined(TARGET_KL05Z)
|
|
|
|
PwmOut pwm_d2(D3);
|
|
|
|
|
2013-02-26 14:57:42 +00:00
|
|
|
pwm_d2.period_ms(10);
|
|
|
|
pwm_d2.write(0.75);
|
|
|
|
printf("%.2f\n", pwm_d2.read());
|
|
|
|
#endif
|
2013-06-27 21:20:47 +00:00
|
|
|
|
2013-02-18 15:32:11 +00:00
|
|
|
notify_completion(true);
|
|
|
|
}
|