Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Digital Input (Single Sample)

Acquire single sample from multiple digital lines of data acquisition device

Library

Data Acquisition Toolbox™

Note

Some devices are not supported by the Simulink® blocks in Data Acquisition Toolbox. To see if your device supports Simulink, refer to Supported Hardware.

Description

The Digital Input (Single Sample) 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 delivers this as a vector of boolean values.

The block has no input ports. It has one or more output ports, depending on the option you choose in its dialog box.

The block inherits the sample time of the model. Digital input acquisition is done synchronously, according to the following diagram.

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.

Note

To use this block, you need both Data Acquisition Toolbox and Simulink software.

Other Supported Features

  • This block supports the use of Simulink Accelerator™ mode, but not Rapid Accelerator or code generation.

  • The block supports the use of model referencing, so that your model can include other Simulink models as modular components.

For more information on these features, see the Simulink documentation.

Dialog Box

Use the Block Parameters dialog box to select a device and set configuration options.

Device

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.

Lines

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.

Line ID — ID of the hardware line (for example, port0/line0). This is automatically detected and filled in by the selected device, and is read-only.

Name — Hardware line name. This is automatically detected and filled in from the hardware, though you can edit the name.

Module — Device ID that the channel belongs to. The Module column is read-only. If a CompactDAQ chassis is selected, it shows the ID of the CompactDAQ module which the channel belongs to; otherwise it shows the ID of the device.

Number of ports

1 for all lines (default) — The block has only one output port for all of the lines that are selected in the table. Acquired data is a vector of boolean values, whose size is the number of lines.

1 per line — The block has 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 the Line ID. For example, if line 2 of hardware port 3 is selected, and you did not specify a name in the line table, port3/line2 appears in the block. Data size for each line is 1-by-1.

Sample time

Specifies the sample time of the block during the simulation. This is the rate at which the block is executed during simulation. The default value is 1. For more information, see What Is Sample Time? (Simulink).

Output Timestamp

Select this option to output the absolute timestamp. This option adds a new output port to the block. The data type of this port is double (datenum), which corresponds to a serial date number. You can convert the data into a datetime array with the datetime function.

Introduced in R2016b

Was this topic helpful?