Analog Output

Select and connect analog output channels

Library

Real-Time Windows Target™

Description

The Analog Output block allows you to select and connect specific analog output channels to your Simulink® model. After you add an Analog Output block to your model, you can enter the parameters for its I/O driver. The block outputs The following procedure uses the HUMUSOFT® AD512 I/O board as an example.

Parameters

Sample time

Enter a value representing how frequently you want the block to execute and interact with the I/O hardware. The block will also synchronize your model with the real-time clock at this sample rate.

    Tip   If you are using a fixed-step solver, you must enter the value you entered in the Fixed step size box from the Configuration Parameters dialog box, or an integer multiple of that value.

Maximum missed ticks

Enter the number of timer ticks that your model can lag behind the real-time kernel. When the model lags by more than this number, the block reports an error and simulation stops. Otherwise, simulation continues even if some ticks are missed.

Show "Missed Ticks" port

Select this check box to display the current number of missed ticks as a block output.

Yield CPU when waiting

Select this check box to grant other programs more CPU time while the kernel waits for a response from the hardware.

Output channels

Enter a channel vector that selects the analog output channels you are using on this board. The vector can be any valid MATLAB® vector form. For example, to select both analog output channels on the AD512 board, enter

[1,2] or [1:2]
Output range

From the list, choose the input range for the analog input channels you entered in the Input channels box. For example, with the AD512 board, choose -5 to 5 V.

If you want the input range to be different for different analog channels, you need to add an I/O block for each different input range.

Block input signal

From the list, choose from the following options:

  • Volts — Expects a value equal to the analog output voltage.

  • Normalized bipolar — Expects a value between -1 and +1 that is converted to the full range of the output voltage regardless of the output voltage range.

  • Normalized unipolar — Expects a value between 0 and +1 that is converted to the full range of the output voltage regardless of the output voltage range. For example, an analog output range of 0 to +5 volts and -5 to +5 volts would both be converted from values between 0 and +1.

  • Raw — Expects a value of 0 to 2n -1. For example, a 12-bit A/D converter would expect a value between 0 and 212 -1 (0 to 4095). The advantage of this method is that the expected value is an integer with no round-off errors.

Initial value

Enter the initial value for each analog output channel you entered in the Output channels box. For example, if you entered [1,2] in the Output channels box, and you want an initial value of 0 volts, enter [0,0].

Final value

Enter a final value for each analog channel you entered in the Output channels box. For example, if you entered [1,2] in the Output channels box, and you want final values of 0 volts, enter [0,0].

Was this topic helpful?