| Target Support Package™ FM5 | ![]() |
Configure Time Processor Unit (TPU3) channel for Rectangular Wave Output (RECTW)
Target Support Package FM5/ MPC555 Driver Library/ Time Processor Unit (TPU3)

This block is provided as an example along with the demo model mpc555rt_tpu_emu. The rectangular wave function is not part of the standard ROM mask of TPU functions but can be downloaded to DPTRAM and used by the TPU in emulation mode.
The TPU3 Rectangular Wave block outputs a rectangular wave with a specified high time and specified wave period. Pulses always begin with a rising edge, and TCR1 is used as the timebase. You can either control the high-time and waveform period registers directly, or enter the desired (ideal) periods and the mask will solve for the best values for the period registers.
If you select the option Use input port to vary HIGH_TIME_RECTW and PERIOD_RECTW, two inputs appear. You can use these to vary the high-time and waveform period. The rest of the parameters in the mask are used as initial values. Input 1 (top) is the high time and input 2 is the period. Inputs must be 16 bit values in the range 0 <= x <= 32768 (0x8000).
The TPU Rectangular Wave block uses TCR1 as a timebase for creating the output waveform. By changing the speed of the TCR1 clock, the range of available waveform 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.

On the Channel Setup tab:
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.
Choose 0-15
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).
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.

On the Waveform Setup tab:
If you select this check box, you can manually set the High-time register and Waveform period register parameters.
You can enter an ideal high-time period (in seconds). From this the high-time register is calculated and appears in the High-time register (HIGH_TIME_RECTW) edit box. The actual waveform period is also calculated and displayed, see below.
Enter the waveform period you want by typing in this edit box. From this the waveform period register is calculated and appears in the Waveform period register (PERIOD_RECTW) edit box. The actual waveform period is also calculated and displayed, see below.
You can enter a value for the high-time register here ( 0<= x <= 32768 (0x8000)) only if you select Edit period registers manually. The actual high-time period is calculated and displayed in the actual high-time period field.
You can enter a value for the period register here ( 0<= x <= 32768 (0x8000)) only if you select Edit period registers manually. The actual waveform period is calculated and displayed in the actual period field.
Information field. You might find this information useful because actual and ideal high-time period are not always the same — the ideal period you enter may not always be possible.
Information field. 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.
Select this box to use input ports to control the high-time and waveform period registers. Two input ports appear on the block (the top input is high-time).
![]() | TPU3 Pulse Width Modulation Out | TPU3 Square Wave | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |