TPU3 Pulse Width Modulation Out

Configure Time Processor Unit (TPU3) channel for pulse width modulation (PWM) output

Library

Target Support Package FM5/ MPC555 Driver Library/ Time Processor Unit (TPU3)

Description

The TPU3 Pulse Width Modulation Out block is used for Pulse Width Modulation (PWM) output from the TPU3 modules. You can use this block in the same way as the MIOS PWM Out block, and with the TPU block you can also vary the period dynamically using a block inport. You can modulate up to 16 of these for each module (A, B or C) using any of the independent TPU channels.

A PWM signal is a rectangular waveform whose period may or may not be constant, and whose duty cycle can be varied, under control of a modulator signal, between 0% and 100%. You can either control the period register directly, or enter the desired (ideal) period and the mask will solve for the best values for the period register. Note for the MIOS Pulse Width Modulation Out block the period is constant, but with the TPU Pulse Width Modulation Out block you can also vary the period of the PWM signal (using the input port for pulse period option you can supply the period as an input).

The TPU3 Pulse Width Modulation Out block acts as the modulator, controlling the duty cycle and period of the signal on the output channel. There can be one or two inputs. Input one (top) is always the duty cycle. Here an input signal in the range 0 to 1 generates a PWM output with corresponding duty cycle. Input signals outside this range cause the duty cycle to saturate at 0% or 100%.

You can specify the period register manually in the mask. If you select the option use input port for pulse period register value, input two appears. Here you can supply the period as an input, instead of specifying the period in the mask. PWMPER input (either block input or specified as a mask variable) must be 16 bit values in the range 0 <= PWM Period Register Value <= 32768 (0x8000).

This saturation means that the block will not allow you to enter a value for PWMPER > 0x8000, or a value for ideal period that makes the PWMPER register go outside this range.

The TPU Pulse Width Modulation Out block uses TCR1 as a timebase for creating the output waveform. By changing the speed of the TCR1 clock, the range of available PWM periods changes. See Time Processor Unit (TPU3) Configuration Parameters for more information on settings for the TCR1 clock.

Refer to Section 17, "Time Processor Unit 3," in the MPC555 User's Manual for further information. See also the relevant TPU3 Application Programming Note (search for "TPUPN17/D").

For an example showing both ways to use this block (specifying the period, and using the PWMPER port to input the period), see the mpc555rt_io demo.

Dialog Box

TPU Module

Select TPU module A, B or C; each has 16 channels. Note that the MPC555 only has modules A and B. MPC565 and MPC566 also have module C. An error will be thrown if you select C and your target processor does not support this.

TPU channel number

Choose 0-15

Channel priority

Choose Low, Medium, or High

The host CPU makes a channel active by assigning it one of the three priorities. You choose the order in which channels are serviced by setting the channel number and assigned priority. The order in which channels are serviced is determined by assigned priority first, followed by channel number (lowest number first).

Use input port for pulse period register value

If you select this box, the parameters relating to setting the period register disappear because they are no longer used.

A new inport appears on the block when you select this option. Here you can input the period register value. Saturation is applied: 0 <= x <= 32768 (0x8000). You can see an example of the block in the demo model mpc555rt_io.

Edit period register manually

If you select this check box, you can set the Pulse period register parameter.

Waveform ideal period

The default is 0.02. You can enter the waveform period you want by typing in this edit box. From this the period register is calculated and appears in the Pulse period register (PWMPER) edit box. The actual waveform period is also calculated and displayed, see below.

Pulse period register (PWMPER)

The default is 12500. You can enter a value for the period register here ( 0<= x <= 32768 (0x8000)) only if you select Edit period register manually. The actual waveform period is calculated and displayed in the actual period field. If Edit period register manually is not selected, this edit box is disabled (gray).

Waveform actual period

You can never enter anything in this box (so it is always gray) — it is there purely to inform you, and does not affect the model code. You might find this information useful because actual and ideal waveform period are not always the same — the ideal period you enter may not always be possible.

Sample time

The default is -1: This setting specifies that the block inherits its sample time from the block connected to its input (inheritance) (unless it is in a triggered subsystem). It makes no sense to sample faster than your input is changing, so normally you leave this at the default.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS