04-04 PWMOutput
From Manuals
(Difference between revisions)
| Line 1: | Line 1: | ||
| - | The PWMOutput example | + | The PWMOutput example demonstrates PwmOut instruction for the MBED-SDK. The PWM output in this example can be observed on D2 (J9 pin 3). |
| + | |||
| + | The PWM signals for this example are mapped to the following locations: | ||
| + | |||
| + | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| + | |+ align="bottom"|'''PWM Ouput Connector Locations''' | ||
| + | |'''PWM1 Output''' | ||
| + | |'''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. | ||
Revision as of 15:03, 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).
The PWM signals for this example are mapped to the following locations:
| PWM1 Output | 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%
}

