Documentation

National Instruments PCI-6221 PWM Generate

PWM Generate block for PCI-6221 and PXI-6221 boards

Library

Simulink® Real-Time™ Library for National Instruments®

Description

Use this block to generate variable frequency and pulse width output.

The M Series boards have two 32-bit counters that you can use to generate pulse trains. Inputs are in counts of the 80 MHz reference frequency on the onboard clock.

  • H input is the number of counts that the output is high.

  • L input is the number of counts that the output is low.

If the H input goes to 0, the output stays low. If the L input goes to 0, the output stays high. If both are 0, the output goes low.

Block Parameters

Counter

From the list, select the counter, 0 or 1, that you want to use. The output for these counters is on the following pins:

CounterPin
0PFI 12 (Pin 2)
1PFI 13 (Pin 40)

Initial high count

Enter the number of counts the output is high between the time the Simulink engine calls the mdlStart routine for this block and the first time it calls mdlOutputs. This length of time depends on the number of blocks in the model and the sorted order as determined by the Simulink software.

If you enter a value of 0, the output stays low until the first time the Simulink engine calls mdlOutputs.

Initial low count

Enter the number of counts the output is low between the time the Simulink engine calls the mdlStart routine for this block and the first time it calls mdlOutputs. This length of time depends on the number of blocks in the model and the sorted order as determined by the Simulink software. If you enter a value of 0, the output stays high until the first time the Simulink engine calls mdlOutputs, unless you have also set H to 0.

Arm input

Select this check box to add a third input port to the block.

  • If the input connected to this port is greater than 0.5, the block arms the counter. Output then occurs.

  • If the input connected to this port is less than or equal to 0.5, the block disarms the counter and the output goes to the level of the value in the Disarm level parameter.

Disarm level

From the list, select the disarm level Disarm to LOW or Disarm to HIGH. If the model disarms the block and the level of the value is Arm input, the output goes to the level you select here.

Stop level

From the list, select the stop level Stop to LOW or Stop to HIGH. When model execution stops, the output goes to the level you choose here.

Sample time

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

PCI slot (-1:autosearch)

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

External Websites

Was this topic helpful?