| Target Support Package™ FM5 | ![]() |
Target Support Package FM5/ MPC555 Driver Library/ Time Processor Unit (TPU3)

The TPU3 Programmable Time Accumulator block reads an input pin and measures an accumulation of time over a specified number of periods - either high time, low time, or the total time. You can output the accumulated time, the number of periods, or both. You can choose whether to start counting total period on a rising or falling edge.
The accumulated time value will be read at most once between any two model steps. TPU interrupts are used to ensure the 32-bit output is updated only when an accumulation is complete. This ensures that the values of the parameters HW and LW combined to create the 32-bit output are coherent. This block is under MPC555 Resource Configuration object control, and you will receive a warning if you have not enabled TPU interrupts. If your model contains any PTA blocks, you must change the TPU IRQ settings to enable interrupts. See Time Processor Unit (TPU3) Configuration Parameters.
Refer to Section 17, "Time Processor Unit 3," in the MPC555 User's Manual for further information. A particularly useful document is the Programmable Time Accumulator TPU Function (PTA) Programming Note — search for "TPUPN06/D."

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).
Outputs the 32-bit time accumulation value (in TCR1 clock ticks) each time MAX_COUNT is reached. Whether the accumulation measures high time, low time or total time depends on the Measure setting.
Outputs the number of periods counted.
Choose from Total high time, Total low time, Total period (starting on rising edge), Total period (starting on falling edge).
Select TCR1 or TCR2. You can configure TCR2 to use an external clock. See Time Processor Unit (TPU3) Configuration Parameters.
Set the number of periods to accumulate time over, up to a maximum of 255. The value is read each time MAX_COUNT is reached. Note that MAX_COUNT is 8-bit here (it is 16-bit in the TPU3 New Input Capture/Input Transition Counter block).
Make sure you set a sample time fast enough not to miss any periods, depending on the frequency of your input signal.
![]() | TPU3 New Input Capture/Input Transition Counter | TPU3 Pulse Width Modulation Out | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |