Files at this revision

API Documentation at this revision

Comitter:
simon
Date:
Tue Dec 01 11:01:48 2009 +0000
Child:
1:4115ae4cbc76
Commit message:

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Dec 01 11:01:48 2009 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/32af5db564d4