From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing Digital Outputs in USB-6002

Trying to understand how to use Tasks and Channels to write Discrete outputs. I see where a Task encapsulates operations and information, and that one or more channels are created and assigned to a Task.

 

How do I write to a single bit in a Port?

In the example code it looks like a channel with 28 lines is created, and all lines are written at once.

Do I need to create a separate Task for each line?

 

Documentation refers to having multiple channels in a task, and that each channel can have a name that is referenced in calls to other functions. I can see how to create a name for channels, but not how to reference individual channels by name in a WriteDigital function.

 

Thanks in advance!

0 Kudos
Message 1 of 3
(1,166 Views)

If you only want to write to one line/port at a time, then each line/port should be put into its own task.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 3
(1,137 Views)

Thanks, I appreciate it. The more I played with it, the more obvious that became. Just didn't understand the concept of creating multiple channels within a single task if I couldn't read/write the channels. It must be that the functions are made generic so that individual functions can handle many different situations.

Thanks again, and thanks for not berating a person asking a simple question.

0 Kudos
Message 3 of 3
(1,100 Views)