Pulse width modulation.
More...
|
| file | PWMA0.h |
| | Pulse width modulation.
|
| |
Pulse width modulation.
PWM pins on the MSPM0G3507
| Pin | Description |
| PB8 | CCP0 PWM output |
| PB9 | CCP1 PWM output |
◆ PWMA0_Backward()
| void PWMA0_Backward |
( |
uint32_t |
duty1 | ) |
|
Motor backward.
Set duty cycle on PB9, and set PB8 high.
- Parameters
-
| duty1 | sets the duty cycle on PB9 |
- Returns
- none
- Note
- assumes PWMA0_Init was called
- See also
- PWMA0_Init
◆ PWMA0_Break()
| void PWMA0_Break |
( |
void |
| ) |
|
Motor break.
Set PB8 high, and set PB9 high.
- Parameters
-
- Returns
- none
- Note
- assumes PWMA0_Init was called
- See also
- PWMA0_Init
◆ PWMA0_Coast()
| void PWMA0_Coast |
( |
void |
| ) |
|
Motor coast.
Set PB8 low, and set PB9 low. Goes into sleep mode
- Parameters
-
- Returns
- none
- Note
- assumes PWMA0_Init was called
- See also
- PWMA0_Init
◆ PWMA0_Forward()
| void PWMA0_Forward |
( |
uint32_t |
duty0 | ) |
|
Motor forward.
Set duty cycle on PB8, and set PB9 high.
- Parameters
-
| duty0 | sets the duty cycle on PB8 |
- Returns
- none
- Note
- assumes PWMA0_Init was called
- See also
- PWMA0_Init
◆ PWMA0_Init()
| void PWMA0_Init |
( |
uint32_t |
timerClkSrc, |
|
|
uint32_t |
timerClkPrescale, |
|
|
uint32_t |
period, |
|
|
uint32_t |
duty0, |
|
|
uint32_t |
duty1 |
|
) |
| |
Initialize PWMA0.
Initialize PWMA0 outputs on PB8, PB9. Rising edge synchronized. timerClkDivRatio = 1. Once started, hardware will continuously output the waves.
- timerClkSrc =
- 2 for 32768 Hz LFCLK
- 4 for 4MHz MFCLK (not tested)
- 8 for 80/32/4 BUSCLK
- G0/G8 is on Power domain PD0
- 32MHz bus clock, BUSCLK clock is 32MHz
- 40MHz bus clock, BUSCLK clock is ULPCLK 20MHz
- 80MHz bus clock, BUSCLK clock is ULPCLK 40MHz
- PWMFreq = (timerClkSrc / (timerClkDivRatio * (timerClkPrescale + 1) * period))
- For example, source=LFCLK, prescale = 0, period = 1000, PWM frequency = 32.768 Hz
- For example, source=BUSCLK, bus=40MHz, prescale=19, period = 10000, PWM frequency = 10kHz
- Parameters
-
| timerClkSrc | is 2 4 or 8 |
| timerClkPrescale | divide clock by timerClkPrescale+1, 0 to 255 |
| period | sets the PWMA0 period |
| duty0 | sets the duty cycle on PB8 |
| duty1 | sets the duty cycle on PB9 |
- Returns
- none
- Note
- Will call LaunchPad_Init to reset and activate power
- See also
- PWMA0_SetDuty
◆ PWMA0_SetDuty()
| void PWMA0_SetDuty |
( |
uint32_t |
duty0, |
|
|
uint32_t |
duty1 |
|
) |
| |
Set duty cycles.
Set duty cycles on PB8, PB9.
- Parameters
-
| duty0 | sets the duty cycle on PB8 |
| duty1 | sets the duty cycle on PB9 |
- Returns
- none
- Note
- assumes PWMA0_Init was called
- See also
- PWM_Init