NI Digital Read Task
Learn how to create a digital read task for NI hardware.
The NI Digital Read Task is used for acquiring data from digital inputs on your NI devices. In this guide, we’ll walk you through the steps to create a digital read task in Synnax.
Prerequisites
Before configuring the task, you’ll need to have connected and configured an NI device.
A Short Primer on Tasks
Tasks are the primary method for communicating with hardware devices in Synnax. Tasks can be used for both control and data acquisition purposes. In the context of the NI Driver, a digital read task defines a background process that reads data from the digital inputs on a particular DAQ card.
A digital read task can be started, stopped, and re-configured at any time. Synnax permanently stores the configuration of the task, so it’s easy to set up multiple tasks for different purposes.
Important Rules for Digital Read Tasks
There are a few important rules to keep in mind when creating a digital read task.
Sample Rates
All channels in the task are sampled at the same rate. If you’d like to sample different channels at different rates, create a separate task to do so.
One Running Task Per Channel
Synnax can only accept live data from a channel from one source at a time. If you have a
task running that reads from a pressure channel, you cannot start another task that
reads from the same channel.
Open the Task Configuration Dialog
From the Devices Toolbar
To create a digital read task from the Devices Toolbar, open the Console and click on the device icon () on the left-hand side of the screen. Find the device you’d like to create the task for, right-click on it, and select “Create digital read task”.
From the Command Palette
To create a digital read task from the command palette, open the Console and click on
the Search and Command Palette at the top. You can also open this palette with with
Ctrl+Shift+P on Windows and Cmd+Shift+P on macOS.
In command mode (enabled when the first character in the input is ”>”), type “NI”. You’ll see an option called “Create an NI Digital Read Task”. Select this option to open the digital read task configuration dialog.
From The Layout Selector
To create a digital read task from the layout selector, click on the add icon () in the top-right corner and select “NI Digital Read Task”.
Configuring the Task
Step 1 Select your NI Device
The first step is to select the NI device you’d like to read data from. Use the dropdown menu in the top-left corner to do so.
Step 2 Add Channels to the Task
Next, you’ll need to add channels to read data from. Click on the add icon () in the channels section. Then, click on the new channel in the list to configure it.
Step 3 Configure Timing
There are two parameters to control the timing of the task: the sample rate and the stream rate. The sample rate defines at how many samples per second the task will read from the device. The stream rate defines how often the task will stream data into Synnax.
For example, if you set the sample rate to 10 Hz and the stream rate to 1 Hz, Synnax will read a batch of 10 samples every second, and then forward the entire batch to the Core.
For very low rate tasks (< 50 Hz), we recommend setting the stream rate to the same value as the sample rate. For higher rate tasks, lowering the stream rate can significantly improve performance. It’s typically best to keep the stream rate below 50 Hz unless you need to quickly process incoming data in real-time.
Step 4 Enable/Disable Data Saving
Data saving defines whether acquired data will be permanently stored in Synnax. When enabled, Synnax will both stream and store data. When disabled, Synnax will only stream data for real-time visualization. Historical data will not be available for review.
Once you’d added all of the channels you need and have configured sampling rates, hit the “Configure” button. If there are no errors, Synnax will acknowledge the configured task and enable the “Play” button in the dialog. Click this button to start the task.
Start the Task
Once you’d added all of the channels you need and have configured task PerformanceTiming, hit the “Configure” button. If there are no errors, Synnax will acknowledge the configured task and enable the Play () button in the dialog. Click this button to start the task.
Starting and stopping a task does not re-apply the task configuration. If you’ve made changes to the configuration, you’ll need to re-configure the task by hitting the “Configure” button.