Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 0:c795e64e9eb0
- Child:
- 1:4115ae4cbc76
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Dec 01 11:01:48 2009 +0000 @@ -0,0 +1,34 @@ +// Testing PWM channel 0 vs channel 1 behaviour, sford + +#include "mbed.h" + +PwmOut pwm1(p26); +PwmOut pwm2(p25); + +int main() { + + uint32_t t = 10000; + + // set period + LPC_PWM1->MR0 = t; + LPC_PWM1->LER |= 1 << 0; + + while (1) { + + // set pulsewidth to 100% + LPC_PWM1->MR1 = t; + LPC_PWM1->MR2 = t; + LPC_PWM1->LER |= 0x6; + + // wait for update + while (LPC_PWM1->LER); + + // set pulsewidth less than 100% + LPC_PWM1->MR1 = t - 500; + LPC_PWM1->MR2 = t - 500; + LPC_PWM1->LER |= 0x6; + + // wait for update + while (LPC_PWM1->LER); + } +}