3.2.17 High-Resolution Pulse Width Modulation Controller (PWM)
The High-Resolution Pulse Width Modulation Controller (PWM) controls several channels independently. Each channel controls one square output waveform. Characteristics of the output waveform such as period, duty-cycle and polarity are configurable through the user interface. Each channel selects and uses one of the clocks provided by the clock generator.
The clock generator provides several clocks resulting from the division of the PWM macrocell master clock. Channels can be synchronized, to generate non overlapped waveforms. All channels integrate a double buffering system in order to prevent an unexpected output waveform while modifying the period or the duty-cycle.
Using The Library
This section describes the features and use of the High-Resolution Pulse-Width Modulation (PWM). This flexible module provides features to support many types of Motor Control (MC) and Power Control (PC) applications, including:
• AC-to-DC Converters
• DC-to-DC Converters
• AC and DC Motor Control: Brushed DC, BLDC, PMSM, ACIM, SRM, Stepper, etc.
• Inverters
• Battery Chargers
• Digital Lighting
• Power Factor Correction (PFC)
• Four Independent PWM Generators, each with Dual Outputs
• Operating modes: – Independent Edge PWM mode – Variable Phase PWM mode – Independent Edge PWM mode, Dual Output – Center-Aligned PWM mode – Double Update Center-Aligned PWM mode – Dual Edge Center-Aligned PWM mode
• Output modes: – Complementary – Independent – Push-Pull
• Dead-Time Generator
• Output Override for Fault Handling
• Flexible Period/Duty Cycle Updating Options
• PWM Control Inputs (PCI) for PWM Pin Overrides and External PWM Synchronization
• Advanced Triggering Options
Library Interface
High-Resolution Pulse Width Modulation Controller peripheral library provides the following interfaces:
Functions
Name | Description |
---|---|
PWM_Initialize | Initializes PWM Peripheral with the given configuration |
PWM_Deinitialize | Deinitializes the PWM to its Power-On Reset (POR) state |
PWM_GeneratorEnable | Enables the specific PWM generator |
PWM_GeneratorDisable | Disables the specific PWM generator |
PWM_ModeSet | Sets the operating mode for a specific PWM generator |
PWM_OutputModeSet | Configures the output mode of a specific PWM generator |
PWM_Enable | Enables all PWM generators |
PWM_Disable | Disables all PWM generators |
PWM_MasterPeriodSet | Sets the period value for the Master Time Base generator |
PWM_MasterDutyCycleSet | Sets the PWM master duty cycle register |
PWM_MasterPhaseSet | Sets the phase value for the Master Time Base generator |
PWM_PeriodSet | Sets the period for a specific PWM generator's Time Base |
PWM_DutyCycleSet | Sets the duty cycle for a specific PWM generator |
PWM_PhaseSelect | Selects the PWM generator source for Phase |
PWM_PhaseSet | Sets the phase value in count for the PWM generator specific Time Base |
PWM_OverrideDataSet | Updates PWM override data bits with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_OverrideDataHighSet | Updates PWM override high data bit with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_OverrideDataLowSet | Updates PWM override low data bit with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_OverrideDataGet | Gets PWM override value for the PWM Generator selected by the argument PWM_GENERATOR |
PWM_OverrideHighEnable | Enables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR. |
PWM_OverrideLowEnable | Enables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR |
PWM_OverrideHighDisable | Disables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR |
PWM_OverrideLowDisable | Disables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR |
PWM_DeadTimeLowSet | Updates PWM Deadtime low register with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_DeadTimeHighSet | Updates PWM Deadtime high register with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_DeadTimeSet | Updates PWM Deadtime low and high register with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_TriggerCompareValueSet | Sets the PWM trigger compare value in count for the PWM Generator selected by the argument PWM_GENERATOR |
PWM_GeneratorInterruptEnable | Enables interrupt requests for the PWM Generator selected by the argument PWM_GENERATOR |
PWM_GeneratorInterruptDisable | Disables interrupt requests for the PWM Generator selected by the argument PWM_GENERATOR |
PWM_GeneratorEventStatusGet | Gets the PWM interrupt status for the PWM Generator selected by the argument PWM_GENERATOR |
PWM_GeneratorEventStatusClear | Clears the PWM interrupt status for the PWM Generator selected by the argument PWM_GENERATOR |
PWM_SoftwareUpdateRequest | Requests to update the data registers for specific PWM generator selected by the argument PWM_GENERATOR |
PWM_SoftwareUpdatePending | Gets the status of the update request for specific PWM generator selected by the argument PWM_GENERATOR |
PWM_TriggerACompareValueSet | Sets the Trigger A compare value in count for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_TriggerBCompareValueSet | Sets the Trigger B compare value in count for a specific PWM generator selected by the argument PWM_GENERATOR |
PWM_TriggerCCompareValueSet | Sets the Trigger C compare value in count for a specific PWM generator selected by the argument PWM_GENERATOR |
Data types and constants
Name | Type | Description |
---|---|---|
PWM_GENERATOR | Enum | Defines the PWM generators that are selected from the MCC Harmony User Interface for the PWM output controls |
PWM_GENERATOR_INTERRUPT | Enum | Defines the PWM generator interrupts that are available for the module to use |
PWM_TRIGGER_COMPARE | Enum |
Defines the PWM generator Trigger Compare registers that are available for the module to use |
PWM_MODES | Enum | Defines the PWM generator operating modes that are available |
PWM_OUTPUT_MODES | Enum | Defines the PWM generator output modes that are available |
PWM_SOURCE_SELECT | Enum | Defines the PWM generator Master or Independent source selection |
PWM_GENERATOR_EOC_EVENT_CALLBACK | Typedef | Callback function type for PWM generator End of Conversion (EOC) event |
PWM_GENERATOR_EOC_EVENT_CALLBACK_OBJ | Struct | Holds the callback and context information for handling events on a specified PWM Generator |