Next
ReferenceHardwareNational InstrumentsDigital write task

NI digital write task

Write command channel values to the digital output lines of an NI device.

An NI digital write task writes the values of command channels to the digital output lines of one NI device. For example, a valve on a schematic can switch port0/line0 of a USB-6343 through a relay.

Each line has a command channel and a state channel. Send 1 to turn a line on and 0 to turn it off.

Before you start, you need a configured device.

The Console gives the digital write tasks of a device one state index channel, and only one writer can hold an index channel. So only one of these tasks can run on a device at a time, even when the tasks use different lines. A second task stops right after it starts, with an error that names the running task. Tasks from a client library have this limit only when they share an index channel.

Create an NI digital write task

When you create command channels with a client library, give each one its own index channel. A writer that holds several commands on one index must write all of them in every frame.

Enterprise
  1. In the devices toolbar, right-click the device and select Create digital write task.
  2. Set State update rate.
  3. Click Add channel, then enter the port and the line in Port/Line.
  4. Click (Start).

The Console creates the channels. For a device with the identifier dev1, port 0, line 0 gives the command channel dev1_do_0_0_cmd with the index dev1_do_0_0_cmd_time, and the state channel dev1_do_0_0_state with the index dev1_do_state_time.

Task options

Console label Python field Default Notes
Device device The key of the device.
State update rate state_rate 10 Hz How often the task writes the state channels.
Data saving data_saving_disabled On See data saving.
Auto start auto_start Off Starts the task each time the Driver starts.

Channel reference

Each channel has a cmd_channel and a state_channel. The table shows the Console label of each setting, with its Python field under it.

Setting Default Notes
Port/Line port, line 0/0 The port, and the line in it.

Troubleshooting

For other problems, see Configure an NI device and Troubleshoot hardware.