| Target Support Package™ FM5 | ![]() |
Configure Time Processor Unit (TPU3) channel for Square Wave Output (SQW)
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 square 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 Square Wave block outputs a square wave with a specified high time (and corresponding low time). Pulses always begin with a rising edge, and TCR1 is used as the timebase.
You can either control the high-time register directly, or enter the desired (ideal) period and the mask will solve for the best values for the period register.
If you select the option Use input port to vary HIGH_TIME_SQW, an input appears. You can use this input to vary the high-time. The rest of the parameters in the mask are used as initial values. The input must be a 16 bit value in the range 0 <= x <= 32768 (0x8000).
The TPU Square 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 (HIGH_TIME_SQW) parameter.
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_SQW) edit box. The actual waveform frequency 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 high-time register manually. The actual high-time period is calculated and displayed in the actual high-time 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.
Select this box to use an input port to control the high-time register. An input port appears on the block.
![]() | TPU3 Rectangular Wave | Watchdog | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |