Analog Input

Select and connect analog input channels


Real-Time Windows Target™


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


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.

Input channels

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

[1,2,3,4,5,6,7,8] or [1:8]

If you want to use the first three analog input channels, enter

Input 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 output signal

From the list, choose from the following options:

  • Volts — Returns a value equal to the analog voltage.

  • Normalized bipolar — Returns a full range value of -1 to +1 regardless of the input voltage range.

  • Normalized unipolar — Returns a full range value of 0 to +1 regardless of the input voltage range. For example, an analog input range of 0 to +5 volts and -5 to +5 volts would both be converted to 0 to +1.

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

Output data type

Set to specify the type of data that the block will output to the model.

Was this topic helpful?