3.17 PWM HS Driver

Overview

The High-Speed PWM (HSPWM) module provides features to support many types of Motor Control (MC) and Power Control (PC) applications such as

  • 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)

Features

  • Operating modes:
    • Independent Edge PWM mode
    • Independent Edge PWM mode, Dual Output
    • Variable Phase PWM Mode
    • Center-Aligned PWM Mode
    • Double Update Center-Aligned PWM Mode
    • Dual Edge Center-Aligned PWM Mode;One Update/Cycle
    • Dual Edge Center-Aligned PWM Mode;Two Updates/Cycle
  • Output modes:
    • Independent Output Mode
    • Complementary Output Mode
    • Push Pull Output Mode
  • High Resolution Support
  • Dead-Time Generator
  • Output Override for Fault Handling
  • Flexible Period/Duty Cycle Updating Options
  • Advanced Triggering Options
  • PWM Event Outputs
  • Configurable Master Clock Source(s) using the harwadre dependent resource(PLIB) in user interface.
    Note: Please refer dsPIC33/PIC24 Family Reference Manual for more information.

3.17.1 Module Documentation

3.17.1.1 PWM Driver

High-Resolution Pulse-Width Modulated (PWM) with Fine Edge Placement using dsPIC MCUs.

3.17.1.1.1 Module description

High-Resolution Pulse-Width Modulated (PWM) with Fine Edge Placement using dsPIC MCUs.

Data structures
  • struct PWM_HS_INTERFACE

    Structure containing the function pointers of PWM driver.

Definitions
Enumerations
Functions
Variables
  • const struct PWM_HS_INTERFACE PWM_HS

    Structure object of type PWM_HS_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. PWM_HS can be changed by the user in the PWM user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.17.1.1.2 Definition Documentation

PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE

#define PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE 1

This macro defines the PWM fault latch clear through software feature availability in the PWM driver.

APIs Supported:  

PWM_FaultModeLatchClear(PWM_GENERATOR genNum);  

Refer driver header file for detailed description of the APIs.

PWM_FAULT_MODE_ENABLE_FEATURE_AVAILABLE

#define PWM_FAULT_MODE_ENABLE_FEATURE_AVAILABLE 0

This macro defines the PWM fault mode enable and disable feature availability in the PWM driver.

APIs Supported:  

NA

PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE

#define PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE 1

This macro defines the PWM master phase feature availability in the PWM driver.

APIs Supported:  

PWM_MasterPhaseSet(uint16_t masterPhase);  

Refer driver header file for detailed description of the APIs.

PWM_SPECIAL_EVENT_FEATURE_AVAILABLE

#define PWM_SPECIAL_EVENT_FEATURE_AVAILABLE 0

This macro defines the PWM special event trigger feature availability in the PWM driver.

APIs Supported:  

NA

PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE

3.17.1.1.3 Function Documentation

PWM_DeadTimeHighSet()

inline static void PWM_DeadTimeHighSet (enum PWM_GENERATOR genNum, uint16_t deadtimeHigh)

This inline function updates PWM Deadtime high register with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in deadtimeHigh

- Deadtime high value

Returns:

none  

PWM_DeadTimeLowSet()

inline static void PWM_DeadTimeLowSet (enum PWM_GENERATOR genNum, uint16_t deadtimeLow)

This inline function updates PWM Deadtime low register with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in deadtimeLow

- Deadtime low value

Returns:

none  

PWM_DeadTimeSet()

inline static void PWM_DeadTimeSet (enum PWM_GENERATOR genNum, uint16_t deadtime)

This inline function updates PWM Deadtime low and high register with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in deadtimeHigh

- Deadtime value

Returns:

none  

PWM_Deinitialize()

void PWM_Deinitialize (void )

Deinitializes the PWM to POR values.

Parameters:
none
Returns:

none  

PWM_Disable()

inline static void PWM_Disable (void )

This inline function will disable all the generators of PWM module.

Parameters:
none
Returns:

none  

PWM_DutyCycleSet()

inline static void PWM_DutyCycleSet (enum PWM_GENERATOR genNum, uint16_t dutyCycle)

This inline function sets the PWM generator specific duty cycle register.

Parameters:
in genNum

- PWM generator number

in dutyCycle

- PWM generator duty cycle

Returns:

none  

PWM_Enable()

inline static void PWM_Enable (void )

This inline function will enable all the generators of PWM module.

Parameters:
none
Returns:

none  

PWM_FaultModeLatchClear()

inline static void PWM_FaultModeLatchClear (enum PWM_GENERATOR genNum)

This inline function clears the status of PWM latched fault mode for the PWM Generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_GeneratorDisable()

inline static void PWM_GeneratorDisable (enum PWM_GENERATOR genNum)

This inline function disables the specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_GeneratorEnable()

inline static void PWM_GeneratorEnable (enum PWM_GENERATOR genNum)

This inline function enables the specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number  

Returns:

none  

PWM_GeneratorEOCEventCallback()

void PWM_GeneratorEOCEventCallback (enum PWM_GENERATOR genNum)

This is the default callback with weak attribute. The user can override and implement the default callback without weak attribute or can register a custom callback function using PWM_EOCEventCallbackRegister.

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_GeneratorEOCEventCallbackRegister()

void PWM_GeneratorEOCEventCallbackRegister (void(*)(enum PWM_GENERATOR genNum) callback)

This function can be used to override default callback PWM_GeneratorEOCEventCallback and to define custom callback for PWM EOCEvent event.

Parameters:
in callback

- Address of the callback function

Returns:

none  

PWM_GeneratorEventStatusClear()

inline static void PWM_GeneratorEventStatusClear (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

This inline function clears the PWM interrupt status for the PWM Generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

in interrupt

- PWM generator interrupt source

Returns:

none  

PWM_GeneratorEventStatusGet()

inline static bool PWM_GeneratorEventStatusGet (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

This inline function gets the PWM interrupt status for the PWM Generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

in interrupt

- PWM generator interrupt source

Returns:

true - Interrupt is pending

false - Interrupt is not pending

PWM_GeneratorInterruptDisable()

inline static void PWM_GeneratorInterruptDisable (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

This inline function disables interrupt requests for the PWM Generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in interrupt

- PWM generator interrupt source

Returns:

none  

PWM_GeneratorInterruptEnable()

inline static void PWM_GeneratorInterruptEnable (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

This inline function enables interrupt requests for the PWM Generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

in interrupt

- PWM generator interrupt source

Returns:

none  

PWM_Initialize()

void PWM_Initialize (void )

Initializes PWM module, using the given initialization data.

Parameters:
none
Returns:

none  

PWM_MasterDutyCycleSet()

inline static void PWM_MasterDutyCycleSet (uint16_t masterDutyCycle)

This inline function sets the PWM master duty cycle register.

Parameters:
in masterDutyCycle

- Master Duty Cycle value

Returns:

none

PWM_MasterPeriodSet()

inline static void PWM_MasterPeriodSet (uint16_t masterPeriod)

This inline function sets the period value in count for the Master Time Base generator.

Parameters:
in masterPeriod

- Period value in count

Returns:

none  

PWM_MasterPhaseSet()

inline static void PWM_MasterPhaseSet (uint16_t masterPhase)

This inline function sets the phase value in count for the Master Time Base generator.

Parameters:
in masterPhase

- Phase value in count

Returns:

none  

PWM_ModeSet()

inline static void PWM_ModeSet (enum PWM_GENERATOR genNum, enum PWM_MODES mode)

This inline function sets the operating mode of specific PWM generator selected  

by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in mode

- PWM operating mode

Returns:

none  

PWM_OverrideDataGet()

inline static uint16_t PWM_OverrideDataGet (enum PWM_GENERATOR genNum)

This inline function gets PWM override value for the PWM Generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

Returns:

Override data for the PWM Generator selected by the argument PWM_GENERATOR.  

PWM_OverrideDataHighSet()

inline static void PWM_OverrideDataHighSet (enum PWM_GENERATOR genNum, bool overrideDataHigh)

This inline function updates PWM override high data bit with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in overrideDataHigh

- Override data  

Returns:

none  

PWM_OverrideDataLowSet()

inline static void PWM_OverrideDataLowSet (enum PWM_GENERATOR genNum, bool overrideDataLow)

This inline function updates PWM override low data bit with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in overrideDataLow

- Override data  

Returns:

none  

PWM_OverrideDataSet()

inline static void PWM_OverrideDataSet (enum PWM_GENERATOR genNum, uint16_t overrideData)

This inline function updates PWM override data bits with the requested value for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in overrideData

- Override data  

Returns:

none  

PWM_OverrideHighDisable()

inline static void PWM_OverrideHighDisable (enum PWM_GENERATOR genNum)

This inline function disables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_OverrideHighEnable()

inline static void PWM_OverrideHighEnable (enum PWM_GENERATOR genNum)

This inline function enables PWM override on PWMH output for specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number  

Returns:

none  

PWM_OverrideLowDisable()

inline static void PWM_OverrideLowDisable (enum PWM_GENERATOR genNum)

This inline function disables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_OverrideLowEnable()

inline static void PWM_OverrideLowEnable (enum PWM_GENERATOR genNum)

This inline function enables PWM override on PWML output for specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_PeriodSet()

inline static void PWM_PeriodSet (enum PWM_GENERATOR genNum, uint16_t period)

This inline function sets the period value in count for the PWM generator specific Time Base.

Parameters:
in genNum

- PWM generator number

in period

- PWM generator period value in count

Returns:

none  

PWM_PhaseSelect()

inline static void PWM_PhaseSelect (enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)

This inline function selects the PWM generator source for Phase.

Parameters:
in genNum

- PWM generator number

in source

- PWM generator source select

Returns:

none  

PWM_PhaseSet()

inline static void PWM_PhaseSet (enum PWM_GENERATOR genNum, uint16_t phase)

This inline function sets the phase value in count for the PWM generator specific Time Base.

Parameters:
in genNum

- PWM generator number

in phase

- PWM generator phase value in count

Returns:

none  

PWM_SoftwareUpdatePending()

inline static bool PWM_SoftwareUpdatePending (enum PWM_GENERATOR genNum)

This inline function gets the status of the update request for specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

Returns:

true - Software update is pending

false - Software update is not pending

PWM_SoftwareUpdateRequest()

inline static void PWM_SoftwareUpdateRequest (enum PWM_GENERATOR genNum)

This inline function requests to update the data registers for specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

Returns:

none  

PWM_Trigger1Disable()

inline static void PWM_Trigger1Disable (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

This inline function disables ADC trigger 1 for the specific compare register selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in compareRegister

- PWM generator number

Returns:

none  

PWM_Trigger1Enable()

inline static void PWM_Trigger1Enable (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

This inline function enables ADC trigger 1 for the specific compare register selected by the argument PWM_GENERATOR.

Precondition:

Trigger value has to be set using PWM_TriggerACompareValueSet, PWM_TriggerBCompareValueSet or PWM_TriggerCCompareValueSet before calling this function.

Parameters:
in genNum

- PWM generator number

in compareRegister

- PWM generator number

Returns:

none  

PWM_Trigger2Disable()

inline static void PWM_Trigger2Disable (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

This inline function disables ADC trigger 2 for the specific compare register selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in compareRegister

- PWM generator number

Returns:

none  

PWM_Trigger2Enable()

inline static void PWM_Trigger2Enable (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

This inline function enables ADC trigger 2 for the specific compare register selected by the argument PWM_GENERATOR.

Precondition:

Trigger value has to be set using PWM_TriggerACompareValueSet, PWM_TriggerBCompareValueSet or PWM_TriggerCCompareValueSet before calling this function.

Parameters:
in genNum

- PWM generator number

in compareRegister

- PWM generator number

Returns:

none  

PWM_TriggerACompareValueSet()

inline static void PWM_TriggerACompareValueSet (enum PWM_GENERATOR genNum, uint16_t trigA)

This inline function sets the Trigger A compare value in count for a specific PWM generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

in trigA

- Trigger A compare value in count

Returns:

none  

PWM_TriggerBCompareValueSet()

inline static void PWM_TriggerBCompareValueSet (enum PWM_GENERATOR genNum, uint16_t trigB)

This inline function sets the Trigger B compare value in count for a specific PWM generator selected by the argument PWM_GENERATOR.  

Parameters:
in genNum

- PWM generator number

in trigB

- Trigger B compare value in count

Returns:

none  

PWM_TriggerCCompareValueSet()

inline static void PWM_TriggerCCompareValueSet (enum PWM_GENERATOR genNum, uint16_t trigC)

This inline function sets the Trigger C compare value in count for a specific PWM generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in trigC

- Trigger C compare value in count

Returns:

none  

PWM_TriggerCompareValueSet()

inline static void PWM_TriggerCompareValueSet (enum PWM_GENERATOR genNum, uint16_t trigCompValue)

This inline function sets the PWM trigger compare value in count for the PWM Generator selected by the argument PWM_GENERATOR.

Parameters:
in genNum

- PWM generator number

in trigCompValue

- Trigger compare value in count

Returns:

none  

3.17.1.1.4 Enumeration Type Documentation

PWM_COMMON_EVENT

enum PWM_COMMON_EVENT

Defines the PWM generator Common Events that are available for the module to use.

PWM_EVENT_A

PWM EVENT_A Output

PWM_EVENT_B

PWM EVENT_B Output

PWM_EVENT_C

PWM EVENT_C Output

PWM_EVENT_D

PWM EVENT_D Output

PWM_EVENT_E

PWM EVENT_E Output

PWM_EVENT_F

PWM EVENT_F Output

PWM_GENERATOR

enum PWM_GENERATOR

Defines the PWM generators that are selected from the MCC Melody User Interface for the PWM output controls. Note: The enum list in the Help document might be just an illustration to show the selected PWM channel list Generated enum list is based on the configuration done by user in the MCC Melody user interface.

PWM_GENERATOR_1

Custom name of PWM generator 1

PWM_GENERATOR_2

Custom name of PWM generator 2

PWM_GENERATOR_3

Custom name of PWM generator 3

PWM_GENERATOR_4

Custom name of PWM generator 4

PWM_MAX_GENERATOR
PWM_GENERATOR_INTERRUPT

enum PWM_GENERATOR_INTERRUPT

Defines the PWM generator interrupts that are available for the module to use.

PWM_GENERATOR_INTERRUPT_FAULT

PWM Generator Fault Interrupt

PWM_GENERATOR_INTERRUPT_CURRENT_LIMIT

PWM Generator Current Limit Interrupt

PWM_GENERATOR_INTERRUPT_FEED_FORWARD

PWM Generator Feed Forward Interrupt

PWM_GENERATOR_INTERRUPT_SYNC

PWM Generator Sync Interrupt

PWM_MODES

enum PWM_MODES

Defines the PWM generator operating modes that are available.

PWM_MODE_INDEPENDENT_EDGE

Independent Edge mode

PWM_MODE_VARIABLE_PHASE

Variable Phase mode

PWM_MODE_INDEPENDENT_EDGE_DUAL_OUTPUT

Independent Edge, dual output mode

PWM_MODE_CENTER_ALIGNED

Center-Aligned mode

PWM_MODE_DOUBLE_UPDATE_CENTER_ALIGNED

Double-Update Center-Aligned mode

PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_ONE_UPDATE_CYCLE

Dual Edge Center-Aligned;one update/cycle mode

PWM_MODE_DUAL_EDGE_CENTER_ALIGNED_TWO_UPDATES_CYCLE

Dual Edge Center-Aligned;two updates/cycle mode

PWM_TRIGGER_COMPARE

enum PWM_TRIGGER_COMPARE

Defines the PWM generator Trigger Compare registers that are available for the module to use.

PWM_TRIGGER_COMPARE_A

PWM Trigger Compare A Register

PWM_TRIGGER_COMPARE_B

PWM Trigger Compare B Register

PWM_TRIGGER_COMPARE_C

PWM Trigger Compare C Register

3.17.1.1.5 Variable Documentation

PWM_HS

const struct PWM_HS_INTERFACE PWM_HS

Structure object of type PWM_HS_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. PWM_HS can be changed by the user in the PWM user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.17.2 Data Structure Documentation

3.17.2.1 PWM_HS_INTERFACE Struct Reference

Structure containing the function pointers of PWM driver.

3.17.2.1.1 Detailed Description

Structure containing the function pointers of PWM driver.

#include <pwm_hs_interface.h>

Data Fields

3.17.2.1.2 Field Documentation

The documentation for this struct was generated from the following file:

source/

pwm_hs_interface.h

CommonEventCallbackRegister

void(* CommonEventCallbackRegister) (void(*callback)(enum PWM_COMMON_EVENT event))

Pointer to PWM_CommonEventCallbackRegister.

CommonEventTasks

void(* CommonEventTasks) (enum PWM_COMMON_EVENT event)

Pointer to PWM_CommonEventTasks (Supported only in polling mode)

DeadTimeHighSet

void(* DeadTimeHighSet) (enum PWM_GENERATOR genNum, uint16_t deadtimeHigh)

Pointer to PWM_DeadTimeHighSet.

DeadTimeLowSet

void(* DeadTimeLowSet) (enum PWM_GENERATOR genNum, uint16_t deadtimeLow)

Pointer to PWM_DeadTimeLowSet.

DeadTimeSet

void(* DeadTimeSet) (enum PWM_GENERATOR genNum, uint16_t deadtime)

Pointer to PWM_DeadTimeSet.

Disable

void(* Disable) (void)

Pointer to PWM_Disable.

DutyCycleSet

void(* DutyCycleSet) (enum PWM_GENERATOR genNum, uint16_t dutyCycle)

Pointer to PWM_DutyCycleSet.

Enable

void(* Enable) (void)

Pointer to PWM_Enable.

FaultModeLatchClear

void(* FaultModeLatchClear) (enum PWM_GENERATOR genNum)

Pointer to PWM_FaultModeLatchClear (Defined if PWM_FAULT_LATCH_SOFTWARE_CLEAR_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

FaultModeLatchDisable

void(* FaultModeLatchDisable) (enum PWM_GENERATOR genNum)

Pointer to PWM_FaultModeLatchDisable (Defined if PWM_FAULT_MODE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

FaultModeLatchEnable

void(* FaultModeLatchEnable) (enum PWM_GENERATOR genNum)

Pointer to PWM_FaultModeLatchEnable (Defined if PWM_FAULT_MODE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

GeneratorDisable

void(* GeneratorDisable) (enum PWM_GENERATOR genNum)

Pointer to PWM_GeneratorDisable (Defined if PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

GeneratorEnable

void(* GeneratorEnable) (enum PWM_GENERATOR genNum)

Pointer to PWM_GeneratorEnable (Defined if PWM_GENERATOR_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

GeneratorEventStatusClear

void(* GeneratorEventStatusClear) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

Pointer to PWM_GeneratorEventStatusClear.

GeneratorEventStatusGet

bool(* GeneratorEventStatusGet) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

Pointer to PWM_GeneratorEventStatusGet.

GeneratorInterruptDisable

void(* GeneratorInterruptDisable) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

Pointer to PWM_GeneratorInterruptDisable.

GeneratorInterruptEnable

void(* GeneratorInterruptEnable) (enum PWM_GENERATOR genNum, enum PWM_GENERATOR_INTERRUPT interrupt)

Pointer to PWM_GeneratorInterruptEnable.

GeneratorTasks

void(* GeneratorTasks) (enum PWM_GENERATOR intGen)

Pointer to PWM_GeneratorTasks (Supported only in polling mode)

MasterPhaseSet

void(* MasterPhaseSet) (uint16_t masterPhase)

Pointer to PWM_MasterPhaseSet (Defined if PWM_GENERATOR_MASTER_PHASE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

ModeSet

void(* ModeSet) (enum PWM_GENERATOR genNum, enum PWM_MODES mode)

Pointer to PWM_ModeSet.

OverrideDataGet

uint16_t(* OverrideDataGet) (enum PWM_GENERATOR genNum)

Pointer to PWM_OverrideDataGet.

OverrideDataHighSet

void(* OverrideDataHighSet) (enum PWM_GENERATOR genNum, bool overrideDataHigh)

Pointer to PWM_OverrideDataHighSet.

OverrideDataLowSet

void(* OverrideDataLowSet) (enum PWM_GENERATOR genNum, bool overrideDataLow)

Pointer to PWM_OverrideDataLowSet.

OverrideDataSet

void(* OverrideDataSet) (enum PWM_GENERATOR genNum, uint16_t overrideData)

Pointer to PWM_OverrideDataSet.

OverrideLowEnable

void(* OverrideLowEnable) (enum PWM_GENERATOR genNum)

Pointer to PWM_OverrideLowEnable.

PeriodSet

void(* PeriodSet) (enum PWM_GENERATOR genNum, uint16_t period)

Pointer to PWM_PeriodSet.

PhaseSelect

void(* PhaseSelect) (enum PWM_GENERATOR genNum, enum PWM_SOURCE_SELECT source)

Pointer to PWM_PhaseSelect.

PhaseSet

void(* PhaseSet) (enum PWM_GENERATOR genNum, uint16_t phase)

Pointer to PWM_PhaseSet.

SoftwareUpdatePending

bool(* SoftwareUpdatePending) (enum PWM_GENERATOR genNum)

Pointer to PWM_SoftwareUpdatePending (Defined if PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

SoftwareUpdateRequest

void(* SoftwareUpdateRequest) (enum PWM_GENERATOR genNum)

Pointer to PWM_SoftwareUpdateRequest (Defined if PWM_SOFTWARE_UPDATE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

SpecialEventPrimaryCompareValueSet

void(* SpecialEventPrimaryCompareValueSet) (uint16_t compareValue)

Pointer to PWM_SpecialEventPrimaryCompareValueSet (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

SpecialEventPrimaryInterruptDisable

void(* SpecialEventPrimaryInterruptDisable) (void)

Pointer to PWM_SpecialEventPrimaryInterruptDisable (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

SpecialEventPrimaryInterruptEnable

void(* SpecialEventPrimaryInterruptEnable) (void)

Pointer to PWM_SpecialEventPrimaryInterruptEnable (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

SpecialEventTriggerInterruptFlagClear

void(* SpecialEventTriggerInterruptFlagClear) (void)

Pointer to PWM_SpecialEventTriggerInterruptFlagClear (Defined if PWM_SPECIAL_EVENT_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

Trigger1Disable

void(* Trigger1Disable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

Pointer to PWM_Trigger1Disable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

Trigger1Enable

void(* Trigger1Enable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

Pointer to PWM_Trigger1Enable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

Trigger2Disable

void(* Trigger2Disable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

Pointer to PWM_Trigger2Disable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

Trigger2Enable

void(* Trigger2Enable) (enum PWM_GENERATOR genNum, enum PWM_TRIGGER_COMPARE compareRegister)

Pointer to PWM_Trigger2Enable (Defined if PWM_TRIGGER_ENABLE_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)  

TriggerACompareValueSet

void(* TriggerACompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)

Pointer to PWM_TriggerACompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

TriggerBCompareValueSet

void(* TriggerBCompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)

Pointer to PWM_TriggerBCompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

TriggerCCompareValueSet

void(* TriggerCCompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)

Pointer to PWM_TriggerCCompareValueSet (Defined if PWM_MULTIPLE_TRIGGER_FEATURE_AVAILABLE is 1 in PWM_features.h, else NULL)

TriggerCompareValueSet

void(* TriggerCompareValueSet) (enum PWM_GENERATOR genNum, uint16_t trigCompValue)

Pointer to PWM_TriggerCompareValueSet.

3.17.3 File Documentation

3.17.3.1 source/pwm.h File Reference

This is the generated driver header file for the PWM driver.

#include <xc.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdlib.h>
#include "pwm_hs_types.h"
#include "pwm_hs_interface.h"

3.17.3.1.1 Functions

3.17.3.1.2 Macros

3.17.3.1.3 Variables

  • const struct PWM_HS_INTERFACE PWM_HS

    Structure object of type PWM_HS_INTERFACE with the custom name given by the user in the Melody Driver User interface. The default name e.g. PWM_HS can be changed by the user in the PWM user interface. This allows defining a structure with application specific name using the 'Custom Name' field. Application specific name allows the API Portability.

3.17.3.1.4 Detailed Description

This is the generated driver header file for the PWM driver.

PWM Generated Driver Header File

3.17.3.1.5 Macro Definition Documentation

PWM_GENERATOR_1_CLOCK_FREQUENCY_IN_HZ

#define PWM_GENERATOR_1_CLOCK_FREQUENCY_IN_HZ 235294UL

This macro is used to read the input clock frequency (in Hz) for PWM Generator 1.

PWM_GENERATOR_2_CLOCK_FREQUENCY_IN_HZ

#define PWM_GENERATOR_2_CLOCK_FREQUENCY_IN_HZ 235294UL

This macro is used to read the input clock frequency (in Hz) for PWM Generator 2.

PWM_GENERATOR_3_CLOCK_FREQUENCY_IN_HZ

#define PWM_GENERATOR_3_CLOCK_FREQUENCY_IN_HZ 235294UL

This macro is used to read the input clock frequency (in Hz) for PWM Generator 3.

PWM_GENERATOR_4_CLOCK_FREQUENCY_IN_HZ

#define PWM_GENERATOR_4_CLOCK_FREQUENCY_IN_HZ 117647UL

This macro is used to read the input clock frequency (in Hz) for PWM Generator 4.

PWM_HS_DeadTimeHighSet

#define PWM_HS_DeadTimeHighSet PWM_DeadTimeHighSet

This macro defines the Custom Name for PWM_DeadTimeHighSet API.

PWM_HS_DeadTimeLowSet

#define PWM_HS_DeadTimeLowSet PWM_DeadTimeLowSet

This macro defines the Custom Name for PWM_DeadTimeLowSet API.

PWM_HS_DeadTimeSet

#define PWM_HS_DeadTimeSet PWM_DeadTimeSet

This macro defines the Custom Name for PWM_DeadTimeSet API.

PWM_HS_Deinitialize

#define PWM_HS_Deinitialize PWM_Deinitialize

This macro defines the Custom Name for PWM_Deinitialize API.

PWM_HS_Disable

#define PWM_HS_Disable PWM_Disable

This macro defines the Custom Name for PWM_Disable API.

PWM_HS_DutyCycleSet

#define PWM_HS_DutyCycleSet PWM_DutyCycleSet

This macro defines the Custom Name for PWM_DutyCycleSet API.

PWM_HS_Enable

#define PWM_HS_Enable PWM_Enable

This macro defines the Custom Name for PWM_Enable API.

PWM_HS_FaultModeLatchClear

#define PWM_HS_FaultModeLatchClear PWM_FaultModeLatchClear

This macro defines the Custom Name for PWM_FaultModeLatchClear API.

PWM_HS_GeneratorDisable

#define PWM_HS_GeneratorDisable PWM_GeneratorDisable

This macro defines the Custom Name for PWM_GeneratorDisable API.

PWM_HS_GeneratorEnable

#define PWM_HS_GeneratorEnable PWM_GeneratorEnable

This macro defines the Custom Name for PWM_GeneratorEnable API.

PWM_HS_GeneratorEOCEventCallbackRegister

#define PWM_HS_GeneratorEOCEventCallbackRegister PWM_GeneratorEOCEventCallbackRegister

This macro defines the Custom Name for PWM_GeneratorEOCEventCallbackRegister API.

PWM_HS_GeneratorEventStatusClear

#define PWM_HS_GeneratorEventStatusClear PWM_GeneratorEventStatusClear

This macro defines the Custom Name for PWM_GeneratorEventStatusClear API.

PWM_HS_GeneratorEventStatusGet

#define PWM_HS_GeneratorEventStatusGet PWM_GeneratorEventStatusGet

This macro defines the Custom Name for PWM_GeneratorEventStatusGet API.

PWM_HS_GeneratorInterruptDisable

#define PWM_HS_GeneratorInterruptDisable PWM_GeneratorInterruptDisable

This macro defines the Custom Name for PWM_GeneratorInterruptDisable API.

PWM_HS_GeneratorInterruptEnable

#define PWM_HS_GeneratorInterruptEnable PWM_GeneratorInterruptEnable

This macro defines the Custom Name for PWM_GeneratorInterruptEnable API.

PWM_HS_Initialize

#define PWM_HS_Initialize PWM_Initialize

This macro defines the Custom Name for PWM_Initialize API.

PWM_HS_MasterDutyCycleSet

#define PWM_HS_MasterDutyCycleSet PWM_MasterDutyCycleSet

This macro defines the Custom Name for PWM_MasterDutyCycleSet API.

PWM_HS_MasterPeriodSet

#define PWM_HS_MasterPeriodSet PWM_MasterPeriodSet

This macro defines the Custom Name for PWM_MasterPeriodSet API.

PWM_HS_MasterPhaseSet

#define PWM_HS_MasterPhaseSet PWM_MasterPhaseSet

This macro defines the Custom Name for PWM_MasterPhaseSet API.

PWM_HS_ModeSet

#define PWM_HS_ModeSet PWM_ModeSet

This macro defines the Custom Name for PWM_ModeSet API.

PWM_HS_OverrideDataGet

#define PWM_HS_OverrideDataGet PWM_OverrideDataGet

This macro defines the Custom Name for PWM_OverrideDataGet API.

PWM_HS_OverrideDataHighSet

#define PWM_HS_OverrideDataHighSet PWM_OverrideDataHighSet

This macro defines the Custom Name for PWM_OverrideDataHighSet API.

PWM_HS_OverrideDataLowSet

#define PWM_HS_OverrideDataLowSet PWM_OverrideDataLowSet

This macro defines the Custom Name for PWM_OverrideDataLowSet API.

PWM_HS_OverrideDataSet

#define PWM_HS_OverrideDataSet PWM_OverrideDataSet

This macro defines the Custom Name for PWM_OverrideDataSet API.

PWM_HS_OverrideHighDisable

#define PWM_HS_OverrideHighDisable PWM_OverrideHighDisable

This macro defines the Custom Name for PWM_OverrideHighDisable API.

PWM_HS_OverrideHighEnable

#define PWM_HS_OverrideHighEnable PWM_OverrideHighEnable

This macro defines the Custom Name for PWM_OverrideHighEnable API.

PWM_HS_OverrideLowDisable

#define PWM_HS_OverrideLowDisable PWM_OverrideLowDisable

This macro defines the Custom Name for PWM_OverrideLowDisable API.

PWM_HS_OverrideLowEnable

#define PWM_HS_OverrideLowEnable PWM_OverrideLowEnable

This macro defines the Custom Name for PWM_OverrideLowEnable API.

PWM_HS_PeriodSet

#define PWM_HS_PeriodSet PWM_PeriodSet

This macro defines the Custom Name for PWM_PeriodSet API.

PWM_HS_PhaseSelect

#define PWM_HS_PhaseSelect PWM_PhaseSelect

This macro defines the Custom Name for PWM_PhaseSelect API.

PWM_HS_PhaseSet

#define PWM_HS_PhaseSet PWM_PhaseSet

This macro defines the Custom Name for PWM_PhaseSet API.

PWM_HS_SoftwareUpdatePending

#define PWM_HS_SoftwareUpdatePending PWM_SoftwareUpdatePending

This macro defines the Custom Name for PWM_SoftwareUpdatePending API.

PWM_HS_SoftwareUpdateRequest

#define PWM_HS_SoftwareUpdateRequest PWM_SoftwareUpdateRequest

This macro defines the Custom Name for PWM_SoftwareUpdateRequest API.

PWM_HS_Trigger1Disable

#define PWM_HS_Trigger1Disable PWM_Trigger1Disable

This macro defines the Custom Name for PWM_Trigger1Disable API.

PWM_HS_Trigger1Enable

#define PWM_HS_Trigger1Enable PWM_Trigger1Enable

This macro defines the Custom Name for PWM_Trigger1Enable API.

PWM_HS_Trigger2Disable

#define PWM_HS_Trigger2Disable PWM_Trigger2Disable

This macro defines the Custom Name for PWM_Trigger2Disable API.

PWM_HS_Trigger2Enable

#define PWM_HS_Trigger2Enable PWM_Trigger2Enable

This macro defines the Custom Name for PWM_Trigger2Enable API.

PWM_HS_TriggerACompareValueSet

#define PWM_HS_TriggerACompareValueSet PWM_TriggerACompareValueSet

This macro defines the Custom Name for PWM_TriggerACompareValueSet API.

PWM_HS_TriggerBCompareValueSet

#define PWM_HS_TriggerBCompareValueSet PWM_TriggerBCompareValueSet

This macro defines the Custom Name for PWM_TriggerBCompareValueSet API.

PWM_HS_TriggerCCompareValueSet

#define PWM_HS_TriggerCCompareValueSet PWM_TriggerCCompareValueSet

This macro defines the Custom Name for PWM_TriggerCCompareValueSet API.

PWM_HS_TriggerCompareValueSet

#define PWM_HS_TriggerCompareValueSet PWM_TriggerCompareValueSet

This macro defines the Custom Name for PWM_TriggerCompareValueSet API.

PWM_MASTER_CLOCK_FREQUENCY_IN_HZ

#define PWM_MASTER_CLOCK_FREQUENCY_IN_HZ 117647UL

This macro is used to read the input clock frequency (in Hz) for Master settings.

3.17.3.2 source/pwm_features.h File Reference

This is the generated module feature header file for PWM driver. This file provides module feature list available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list.

3.17.3.2.1 Macros

3.17.3.2.2 Detailed Description

This is the generated module feature header file for PWM driver. This file provides module feature list available on the selected device. The macros defined in this file provides the flexibility to easily migrate the user application to other device which might have varied feature list.

PWM Generated Feature Header File

The content in this file is strictly "read only" and should not be altered

3.17.3.3 source/pwm_hs_interface.h File Reference

#include <stdbool.h>
#include <stdint.h>
#include "pwm_hs_types.h"

3.17.3.3.1 Data structures

  • struct PWM_HS_INTERFACE

    Structure containing the function pointers of PWM driver.

3.17.3.3.2 Detailed Description

PWM Generated Driver Interface Header File

3.17.3.4 source/pwm_hs_types.h File Reference

This is the generated driver types header file for the PWM driver.

3.17.3.4.1 Enumerations

3.17.3.4.2 Detailed Description

This is the generated driver types header file for the PWM driver.

PWM Generated Driver Types Header File

3.17.3.4.3 Enumeration Type Documentation

PWM_SOURCE_SELECT

enum PWM_SOURCE_SELECT

PWM_SOURCE_SELECT_INDEPENDENT

PWM select Independent PWM as source

PWM_SOURCE_SELECT_MASTER

PWM select Master as source