Jump to main content

##

# 3.3.22.1 mcPwmI_PulseWidthModulationInit

## C

    /* Initialize PWM modulator */
    void  mcPwmI_PulseWidthModulationInit( tmcPwm_Parameters_s * const pParameters )

## Summary

Initialize PWM modulator

## Description

This function initializes the Pulse Width Modulation (PWM) modulator by setting up the necessary parameters and linking state variables. It updates the state variable structure and configures the module parameters using the provided parameter structure. The function defines the PWM duty cycle by setting parameters such as the PWM period count, PWM duty cycle limits, and modulation index limits. Additionally, it calculates and updates the DC bus utilization factor.

## Precondition

The state structure `mcPwm_State_mds` and macro `DT_PADDING` should be defined and accessible.

## Parameters

Param | Description
--- | ---
pParameters | A pointer to the pwm modulator parameter structure

## Returns

None

## Example

    // Define the pwm modulator data structure
    tmcPwm_Parameters_s pwmParameters;

    /** Initialize PWM  module */
    mcPwmI_PulseWidthModulationInit(&pwmParameters);;

## Remarks

Note: Ensure that `pParameters` is properly initialized with valid values before calling this function.