5.1.84. PWM output — fixed frequency (pdx_PWMOutput)

Pulse the output channel pin at a fixed frequency and variable duty cycle.

5.1.84.1. Supported targets

All targets

5.1.84.2. Required license

None (Main library). (See Section 2.3, “Licensed Features”.)

5.1.84.3. Description

The PWM output block causes the channel output pin to oscillate at a desired frequency and duty cycle. The duty cycle is the High time divided by the Cycle time.

The actual state of the output pin is determined by the polarity of the pin. Some outputs are low-side only, some are high-side only, and some are software selectable. For software selectable pins, the polarity of the output can be selected by using the pdx_DigitalOutput block with the DOT select-high-side signal for the associated pin. Refer to the technical specification section for details on which pins support which polarities on each target.

Regardless of polarity, if the output is non-inverted, the output pin will be active during the High time and the output pin will be off (high impedance) during the Low time. If the output is inverted, the output will be active during the Low time and off during the High time.

This block calculates the output duty cycle as:

output duty cycle = Minimum duty cycle + (Maximum duty cycle - Minimum duty cycle) * duty_cycle

If the Minimum duty cycle is 0 and the inport duty_cycle is 0, the output channel state is set low and does not oscillate. When the Maximum duty cycle is 1 and the inport Duty_cycle is 1, the output channel state is set high and does not oscillate.

The block supports 0% and 100% duty cycles, where the output signal no longer pulses. A 0% duty cycle is defined as High time equals zero and 100% duty cycle is defined as Low time equals zero.

The channel output pin state can be inverted in order to achieve the desired logical output state.

The channel output can be offset from other PWM channels of the same frequency. The {Offset} parameter is used to delay the start of the PWM cycle, so that the PWM pulse will not occur at the same time as other PWM signals of the same frequency.

If the inport fault input is nonzero, then the output is set to the default duty cycle mask parameter. The default duty cycle is never inverted and can only be set to zero or one so care should be taken to chose the appropriate value to disable the output during a fault condition.

5.1.84.4. Inports

  • duty_cycle

    Ratio of the high time to the signal cycle time.

    Range: [0, 1] duty-cycle

    Value type:Real
    Calibratable:No
  • fault

    Place a 1 here to force the block to use the default duty cycle for the output, 0 otherwise.

    Range: 0 or 1

    Value type:Boolean
    Calibratable:No

5.1.84.5. Outports

  • sim_duty_cycle

    Only used in simulation. this outport is set to the requested duty cycle (i.e., duty_cycle or the default duty cycle).

    Range: [0, 1] duty-cycle

    Value type:Real
    Calibratable:No

5.1.84.6. Mask parameters

  • Channel

    The channel pin for this pwm output.

    Value type:List
    Calibratable:No
  • Inversion

    Inverts the mapping of the input value to the channel pin. If inversion is ticked then a logical NOT operation is applied to the output state.

    Value type:Boolean
    Calibratable:No
  • Default duty cycle

    This value is used if fault is active. The value is mapped directly to the output channel and is never inverted. Care should be taken to choose the appropriate value to drive the output off.

    Range: 0 or 1 duty-cycle

    Value type:Real
    Calibratable:Yes, offline and online
  • Initial duty cycle

    The duty cycle that is output before the block has first been executed. This value is used in a similar way to Default duty cycle in that it is never inverted, however it can be set anywhere in the range 0 to 1.

    Range: [0, 1] duty-cycle

    Value type:Real
    Calibratable:Yes, offline and online
  • Frequency

    The frequency of the pwm signal.

    Range: [0.5, 10000] Hz

    Value type:Real
    Calibratable:Yes, offline and online
  • Offset

    The desired phase offset, in milliseconds, of the PWM output, relative to other PWM output channels that have been configured with the same frequency.

    Range: Target dependent

    TargetRange
    M110Not supported
    M220Not supported
    M221Not supported
    M250[0, 2000] ms
    M460[0, 2000] ms
    M461Not supported
    M670Not supported

    Value type:Real
    Calibratable:Yes, offline
  • Minimum duty cycle

    Must be in the range 0 to (Maximum duty cycle - 0.1).

    Range: [0, 0.9] duty-cycle

    Value type:Real
    Calibratable:Yes, offline and online
  • Maximum duty cycle

    Must be in the range (Minimum duty cycle + 0.1) to 1.0.

    Range: [0.1, 1] duty-cycle

    Value type:Real
    Calibratable:Yes, offline and online
  • Provide simulation output?

    Tick to enable outport sim_duty_cycle.

    Value type:Boolean
    Calibratable:No

5.1.84.7. Notes

  • The resolution of the PWM channels depends on the output device (specified in the hardware target tables in Section 1.1, “ECU hardware reference documentation”). Some channels have better resolution that others.

  • Some of the PWM output channels do not produce an accurate wave form when the duty cycle is either very small (e.g., 0.5%) or very large (e.g., 99.5%). All PWM output channels cope with 0% and 100% duty cycles correctly.

    For the M250 target specifically, in order to avoid shoot-through and damage to the ECU when the mode switches, a 100us dead-time is inserted in the PWM signal for one task cycle at the beginning of mode-transition. Additionally, this dead-time insertion will only occur if the duty cycle that is commanded has a low time of less than 100us. For this reason, it will not be possible to command a 100% duty cycle during mode-transition for one task period.