SEARCH
TOOLBOX
LANGUAGES
modified on 17 September 2014 at 18:20 ••• 39,582 views

04-04 PWMOutput

From Manuals

(Difference between revisions)
Jump to: navigation, search
 
(5 intermediate revisions not shown)
Line 1: Line 1:
-
The PWMOutput example sets PWM source to a fixed frequency and duty cycle. The PWM output can be observed on D2 (J9 pin 3).
+
The PWMOutput example demonstrates PwmOut instruction for the MBED-SDK. The PWM output in this example can be observed on D2 (J9 pin 3) of the BAM210.
 +
 
 +
The PWM signals for the MBED-SDK and the Bambino line of microcontrollers are mapped to the following connector locations:
 +
{| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;"
 +
|+ align="bottom"|'''PWM Ouput Connector Locations'''
 +
|'''PWM Signal'''
 +
|'''LPC4330 PIN NAME'''
 +
|'''BAM210E'''
 +
|'''BAM210'''
 +
|'''BAM200E'''
 +
|'''BAM200'''
 +
|-
 +
|PWM1
 +
|P1_7
 +
|J9-3
 +
|J9-3
 +
|S2-3
 +
|S2-3
 +
|-
 +
|PWM2
 +
|P7_6
 +
|J9-8
 +
|J9-8
 +
|S4-6
 +
|S4-6
 +
|-
 +
|PWM3
 +
|P6_12
 +
|J10-1
 +
|J10-1
 +
|S10-3
 +
|n/p
 +
|-
 +
|PWM4
 +
|P4_6
 +
|J10-3
 +
|J10-3
 +
|S2-6
 +
|S2-6
 +
|-
 +
|PWM5
 +
|P7_5
 +
|J8-2
 +
|J8-2
 +
|S4-4
 +
|S4-4
 +
|-
 +
|PWM6
 +
|P4_1
 +
|J8-3
 +
|J8-3
 +
|S3-4
 +
|S3-4
 +
|-
 +
|PWM7
 +
|P7_7
 +
|J8-4
 +
|J8-4
 +
|S4-5
 +
|S4-5
 +
|-
 +
|PWM8
 +
|P2_8
 +
|J12-4
 +
|n/p
 +
|S8-3
 +
|n/p
 +
|-
 +
|PWM9
 +
|P2_9
 +
|J12-6
 +
|n/p
 +
|S9-3
 +
|n/p
 +
|-
 +
|PWM10
 +
|P7_1
 +
|J13-5
 +
|n/p
 +
|S9-8
 +
|n/p
 +
|-
 +
|PWM11
 +
|P7_0
 +
|J13-6
 +
|n/p
 +
|S9-9
 +
|n/p
 +
|-
 +
|PWM12
 +
|P1_5
 +
|J14-7
 +
|n/p
 +
|S10-6
 +
|n/p
 +
|-
 +
|}
  /*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope.
  /*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope.
Line 12: Line 108:
  }
  }
 +
PWM1 was captured on the oscilloscope in the image below.
[[Image:BAM210_04_04.png|center|]]
[[Image:BAM210_04_04.png|center|]]

Current revision as of 18:20, 17 September 2014

The PWMOutput example demonstrates PwmOut instruction for the MBED-SDK. The PWM output in this example can be observed on D2 (J9 pin 3) of the BAM210.

The PWM signals for the MBED-SDK and the Bambino line of microcontrollers are mapped to the following connector locations:

PWM Ouput Connector Locations
PWM Signal LPC4330 PIN NAME BAM210E BAM210 BAM200E BAM200
PWM1 P1_7 J9-3 J9-3 S2-3 S2-3
PWM2 P7_6 J9-8 J9-8 S4-6 S4-6
PWM3 P6_12 J10-1 J10-1 S10-3 n/p
PWM4 P4_6 J10-3 J10-3 S2-6 S2-6
PWM5 P7_5 J8-2 J8-2 S4-4 S4-4
PWM6 P4_1 J8-3 J8-3 S3-4 S3-4
PWM7 P7_7 J8-4 J8-4 S4-5 S4-5
PWM8 P2_8 J12-4 n/p S8-3 n/p
PWM9 P2_9 J12-6 n/p S9-3 n/p
PWM10 P7_1 J13-5 n/p S9-8 n/p
PWM11 P7_0 J13-6 n/p S9-9 n/p
PWM12 P1_5 J14-7 n/p S10-6 n/p
/*Sets PWM source to fixed frequency and duty cycle. Observe output on oscilloscope.
                                                                  */
#include "mbed.h"
PwmOut pwm(PWM1);               //create a PWM output called pwm on pin PWM1

int main()
{
    pwm.period(0.010);                // set PWM period to 10 ms
    pwm=0.5;                         // set duty cycle to 50%
}

PWM1 was captured on the oscilloscope in the image below.