NI Digital Write Task

Learn how to create a digital write task for NI hardware.

The Digital Write Task is used for sending commands to the digital outputs of your NI cards. In this guide, we’ll walk you through the steps to create a Digital Write Task in Synnax.

Prerequisites

Before configuring the task, you’ll need to have connected and configured an NI device and created the relevant channels in Synnax. Check out the Configure Device guide for more information.

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 write task defines a background process that writes to the digital outputs of your device.

A digital write task can be started, stopped, and re-configured at any time. We permanently store the configuration of the task in Synnax, so it’s easy to set up multiple tasks for different purposes.

How Commands Work in Synnax

Commands in Synnax require two types of channels: a command channel and state channel. Command channels are used to send commands to hardware. To set a digital output to high, you would write a 1 to the command channel. To set it to low, you would send a 0.

State channels represent the current state of the digital output. When you send a command, the corresponding digital write task will process the command and update the value in the state channel.

As an example, to configure a valve in the console schematic to write to a digital output, you would set the output channel as the command channel and the state channel as the input channel. Clicking the valve would send a command to the digital output, and the valve would turn solid or transparent based on the state channel.

Open the Task Configuration Dialog

From the Resources Toolbar

To create a digital write task from the resources toolbar, open the Synnax Console and click on the “Resources” tab in the left sidebar. Find the device you’d like to create the task for, right-click on it, and select “Create Digital write Task”.

From the Command Palette

To create a digital write task from the command palette, open the Synnax Console and click on the Quick Search & Command Palette at the top. You can also open this palette with Ctrl+Shift+P on Windows/Linux and Cmd+Shift+P on macOS.

In command moe (enabled when the first character in the input is ”>”), type “NI”. You’ll see an option called “Create a New Digital write Task”. Select this option to open the read task configuration dialog.

From The Layout Selector

To create a digital write task from the layout selector, click on the ”+” button in the top right corner and select “NI Digital write Task”.

Configure the Task

Step 1 Select your NI Device

The first step is to select teh NI device you’d like to write to the outputs of. 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 the channels you’d like to write to. Click the ”+” button in the channels section. Then, click on the new channel in the list to configure it.

You’ll need to select both a digital output port and line to write to. You’ll also need to select the command channel the task will listen to, and the state channel that will be updated when the command is processed.

Step 3 Configure the State Update Rate

The state update rate determines how often the state channels in the task are updated. Set the rate higher in scenarios that require quick response times.

Step 4 Start the Task

Once you’ve 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.