TPU3 New Input Capture/Input Transition Counter

Configure Time Processor Unit (TPU3) channel for New Input Capture/Input Transition Counter (NITC)

Library

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

Description

The TPU3 New Input Capture/Input Transition Counter block counts transitions on the input pin and/or captures a TCR timebase value or a TPU parameter RAM value after a certain number of transitions. You can select the number of transitions and whether to capture on rising or falling transitions or both.

You can select up to three outputs to display. Each will have a separate outport:

You can choose whether to capture the TCR1 timebase value each time the MAX_COUNT number of transitions is reached, or you can specify the address of a TPU parameter in RAM to capture at that moment. Note this block always operates in continuous mode, not single-shot — transitions are counted up to MAX_COUNT and then the block resets and continues counting from zero.

We cannot guarantee that the three outputs are read coherently. They are read one after another, and it is possible that while the memory is accessed for one parameter the next to be read may have changed value. This depends on the speed of your input signal. This should not be important for most purposes because only TRANS_COUNT or FINAL_TRANS_TIME will be the outputs of interest.

As an example, you could use this block in conjunction with the TPU3 Fast Quadrature Decode block for calibration purposes. Quadrature encoders often generate an index signal in addition to the pair of signals whose relative phase contains the position information. You could put this index signal into an NITC input to count pulses in order to calibrate the position of the encoder.

Refer to Section 17, "Time Processor Unit 3," in the MPC555 User's Manual for further information. A particularly useful document is the TPU New Input Capture/Input Transition Capture Programming Note — search for "TPUPN08/D." Look in the appropriate TPU programming note to look up parameter addresses if you want to capture TPU Parameters instead of TCR1 clock ticks.

As an example of using TPU parameters, if you wanted to use this block to capture the position count from a TPU Fast Quadrature Decode block, you need to set the correct channel number and parameter address. You must set the channel number to the primary FQD channel (FQD blocks use a pair of channels, the first is primary). Each TPU channel can have up to eight parameters (0 through 7), in this case you must choose parameter 1 (POSITION_COUNT).

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).

Show FINAL_TRANS_TIME port

Outputs the value captured each time the maximum number of transitions (MAX_COUNT) is reached. This value is only captured when MAX_COUNT is reached.

Show TRANS_COUNT port

Outputs the number of transitions counted. Resets to zero each time MAX_COUNT is reached.

Show LAST_TRANS_TIME port

Outputs the captured value at the latest transition. This is updated at every transition except the final one.

Detect transition on:

Choose from Rising Edge, Falling Edge or Either Edge.

Capture:

TCR1 Value — captures the value of the TCR1 timebase. See Time Processor Unit (TPU3) Configuration Parameters for information on setting the TCR1 timebase.

Parameter RAM Value — captures the value of a TPU parameter in RAM. If you select this option you enable the parameters to choose the TPU channel number and parameter address, or to specify a parameter alias.

Specify parameter location by

Channel and Parameter Index — if you select this option you enable the two parameters to specify which TPU channel (from 0-15) and which parameter index (out of up to eight parameters per TPU channel) you want.

Parameter Alias — If you select this option you enable the Parameter alias edit box. For example you can specify a parameter alias for the POSITION_COUNT parameter in the TPU3 Fast Quadrature Decode block. See TPU3 Fast Quadrature Decode.

Note that you cannot set the parameter location unless you have chosen Parameter RAM Value for the Capture parameter.

TPU channel to capture parameter from

Specify which TPU channel (from 0-15) you want. This option is enabled when you choose to specify parameter location by Channel and Parameter Index.

Channel parameter (16-bit) to capture

Specify which parameter index (out of up to eight parameters per TPU channel) you want. This option is enabled when you choose to specify parameter location by Channel and Parameter Index.

Parameter alias

This option is enabled when you choose to specify parameter location by Parameter Alias. Enter the required alias in the edit box. For example you can specify a parameter alias for the POSITION_COUNT parameter in the TPU3 Fast Quadrature Decode block. See TPU3 Fast Quadrature Decode.

Number of transitions before capture and reset (MAX_COUNT)

This must be a 16-bit number specifying how many transitions to count before capturing and then resetting. A zero will be equivalent to 1 (you cannot count zero transitions) and you must not exceed the maximum of a uint16 number. The range of an unsigned 16-bit number is 0-65535 (because 65535 = (2^16) - 1).

Range checking is applied; you will receive a warning if you input an unsuitable number.

Sample time

Be sure to set the sample time fast enough not to miss any transitions. This will depend on the frequency of your input signal.

  


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