-
Notifications
You must be signed in to change notification settings - Fork 0
PWM Structures
Ryan Summers edited this page Sep 7, 2015
·
4 revisions
This page documents the structures used within the PWM peripheral library of SUBLIBinal. Please select the appropriate structure from the list below to read more about it.
Definition
typedef struct {
float dutyCycle;
Timer_Config timer;
Pin pin; //our output pin
uint8 enable;
PWM_Channel channel;
}PWM_Config;
Description
The PWM_Config
structure is used for configuring a PWM channel for use.
Parameters
- dutyCycle: this should be a value between 0 and 1 and specifies the duty cycle of the PWM waveform.
- timer: this should be a complete filled out and initialized timer structure that will be used for the PWM generation. Only the PWM frequency depends on this structure. The timer structure can only utilize timers 2 and 3 for PWM generation. No other timers may be used.
-
pin: This should be the desired output pin. Please refer to the documentation on page 11 and 12 to determine which pins are available for use by your selected PWM channel specified in
channel
. - enable: this parameter specifies whether the PWM should be enabled after configuration
- channel: this specifies which PWM channel will be used. Each channel can only be used to generate a single PWM waveform.
SUBLIBinal was created by the Palouse Robosub Club.