Acquire latest set of values from multiple digital lines of data acquisition device
Data Acquisition Toolbox™
Note: You cannot use certain devices with Data Acquisition Toolbox Simulink® blocks. Refer to the Supported Hardware page to see if your device supports Simulink use.
The Digital Input block synchronously outputs the latest scan of data available from the digital lines selected at each simulation time step. It acquires unbuffered digital data, and the data delivered is a binary vector.
Note: You need a license for both Data Acquisition Toolbox and Simulink software to use this block.
The block has no input ports. It has one or more output ports, depending on the option you choose in the Source Block Parameters dialog box. The following diagram shows the block configured with one port for all lines and with one port for each line, in the case of a device that has 17 lines selected.
The block inherits the sample time of the model.
The output data is always a binary vector (binvec), i.e., a vector of logical values.
Digital input acquisition is done synchronously. The following diagram shows synchronous digital input.
At the first time step (T1), data is acquired from the selected hardware lines. The simulation does not continue until data is read from all lines.
The Digital Input block supports the use of Simulink Accelerator™ mode. This feature speeds up the execution of Simulink models.
Note: You need the C++ Compiler to use Simulink Accelerator mode.
The block supports the use of model referencing. This feature lets your model include other Simulink models as modular components.
For more information on these features, see the Simulink documentation.
Use the Source Block Parameters dialog box to set configuration options.
The data acquisition device from which you want to acquire data. The items in the list vary, depending on which devices you have connected to your system. Devices in the list are specified by adaptor/vendor name and unique device ID, followed by the name of the device. The first available device is selected by default.
The line configuration table lists your device's lines and lets you configure them. The table lists all the lines that can be configured for input. Use the check boxes and selection buttons to specify which lines to acquire data from.
Specifies the ID for each hardware port. This is automatically detected and filled in by the selected device, and is read only.
Specifies the ID of the hardware line. This is automatically detected and filled in by the selected device, and is read only.
Specifies the hardware line name. This is automatically detected and filled in from the hardware, though you can edit the name.
Select 1 for all hardware lines (default) or 1 per hardware line.
Using 1 for all hardware lines means that the block will have only one output port for all of the lines that are selected in the table. Data must be [S x number of lines], where S is the number of samples. Data will be a binary vector (binvec).
Using 1 per hardware line means the block
will have one output port per selected line. The name of each output
port is the name specified in the table for each line. If no name
is provided, the name is "Port" + HwPort ID + "Line"
+ Line ID. For example, if line 2 of hardware port 3 is selected,
and you did not specify a name in the line table,
in the block. Data will be [1 x 1].