Documentation

MPL PATI PWM generate

MPL PATI PWM generate block

Library

Simulink® Real-Time™ Library for MPL

Scaling Output to Input

I/O Module Output

Block Input Data Type

Scaling

0 to 5 volts

Double

Counts

General Description

This block uses the PWM module in the time processor units (TPUs) on the board to generate rectangular wave output. See the MPC555 documentation from Freescale™ Semiconductor at http://www.freescale.com for more information on the PWM module.

This block has three inputs:

  • H — Number of counts of the chosen time base that the output should remain high. You can use a count from 0 to 32767. With the use of multiple channels, you might not be able to get your output to 0 width smoothly. If you have a small number of channels, you can try to use the channel Priority parameter to more smoothly approach 0 width.

  • L — Number of counts of the chosen time base that the output should remain low. Range from 0 to 32767. With the use of multiple channels, you might not be able to smoothly get your output to 0 width. If you have a small number of channels, you can try to use the channel Priority parameter to more approach 0 width smoothly.

  • A — Specifies whether or not the output is to be armed. If the A input is 0, the block stops the output and the output level is the one chosen in the dialog. If A is 1, the output runs. This port does not appear if you do not select Arm input.

    Note:   To execute a model using this block, you must first write MPL boot code on the EEPROM using the MPL PATI EEPROM Write block.

    To flash the EEPROM with the boot code, add the EEPROM Write block to an empty model, then build and execute that model before executing the actual model. See MPL PATI EEPROM Write block for further information.

Limitations

If you use multiple blocks for different channels, the relative timing between the output signals is not controlled and is not repeatable on the order of a few 10s of microseconds even if the output frequency is the same.

Block Parameters

Channel

From the list, select a channel from 1 to 32. This board has two TPUs. Channels 1 through 16 are on the first TPU, channels 17 through 32 are on the second TPU. The channel you select works with the Timebase parameter.

Priority

From the list, select Low, Medium, or High priority. This changes the order that individual timers are serviced. See the MPC555 TPU documentation for more information.

Initial high count

Enter the high count to be used from initialization until the model is running.

Initial low count

Enter the low count to be used from initialization until the model is running.

Immediate update

Select this check box to force the output to use the new count immediately. Selecting this check box can result in very short output pulses. It terminates long pulses immediately.

Clear this check box to allow the current output cycle to finish before the update. Clearing this check box generates smoother frequency and phase transitions without transients.

The block does not interrupt long pulses. Note that your selection of this parameter value depends on your system requirements.

Arm input

Select this check box to indicate that the ARM input is present. If this check box is selected, the channel behaves as follows. Note that there might be a delay, on the order of the output period, between the time that the ARM input becomes 1 and the output port starts changing.

  • If the input signal to this port is 1, the channel outputs the signal specified by the H and L ports.

  • If the input signal is to this port is 0, the output stops at the level specified by the Disarm state drop-down list.

If you do not select this check box, the block behaves as if the ARM input is 1. Input port A does not appear.

Disarm state

From the drop-down list, select

  • Disarm to LOW

  • Disarm to HIGH

When the ARM input is 0, this parameter specifies the state of the output.

State on model stop

From the drop-down list, select

  • Leave running

    Continue to get output pulses at the last H and L port values.

  • Stop to LOW

    Immediately go to the LOW output state and maintain that level.

  • Stop to HIGH

    Immediately go to the HIGH output state and maintain that level.

Timebase

From the list, select TCR1 or TCR2. This depends on the MPL PATI Timebase Setup settings. If you do not use the MPL PATI Timebase Setup block, the TCR1 time base defaults to 1.25 MHz.

Sample time

Enter the base sample time or a multiple of the base sample time (-1 means sample time is inherited).

PCI slot

If only one board of this type is in the target computer, enter -1 to locate the board.

If two or more boards of this type are in the target computer, enter the bus number and the PCI slot number of the board associated with this driver block. Use the format [BusNumber,SlotNumber]. To determine the bus number and the PCI slot number, type:

tg = slrt;
getPCIInfo(tg, 'installed')

Was this topic helpful?