Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

In C#, how can i read the current state of a task's digital output?

I'm programming C#.Net with Measurement Studio.  My app' uses a USB-6501 device of which i'v deployed some digital outputs.  Of the various routes that may occur within my app', those outputs can be any state (true/false) due code execution of the app' and at other certain points within the app' the state of those outputs needs to be determined.   Ideally, i would like to read the associated task to determine this state; how do i do this?

 

Thanks,

Glenn

0 Kudos
Message 1 of 6
(3,610 Views)

Hi Glenn,

 

I understand that you are developing an application in which you deploy some digital outputs, and you would like to be able to determine the state of those outputs at various points in your application. With the USB-6501, you can configure the digital I/O lines to act as inputs or outputs individually.  So you could have your digital output tasks write values to the digital output lines, while you would be running a digital input task on different digital I/O lines to determine the state of the digital lines wherever it may be of interest for you to do so.

 

Regards,

Wallace F.

National Instruments
Applications Engineer
0 Kudos
Message 2 of 6
(3,600 Views)

If I understand your prescription correctly (physically connect two lines whereas one is the subject output and the other is an input that serves as feedback of the said output), I appreciate that method as being an absolute solution.  However, I don't have the financial or chronological budget to add more points (i would have to add another module as all I/O of my project is allocated).  Respectively, is there an alternative solution that would allow me to read the 6501's output state for a subject line that i write to via a digital output task?  e.g. Can i include a digital input task that references a line that i write to from a digital output task?

 

Thanks,

Glenn

0 Kudos
Message 3 of 6
(3,596 Views)

Welp, i answered my own question but thanks for the inspiration; i.e. i can associate a DigitalReader and DigitalWriter to the same task and get the results i expect.    At least it's working so far in a simple environment; i just tried it for one line/task with only one challenge within the app' ("if output is off" / turn it on).  Now i'm off to exploit this with more challenges/conditionals for more lines/tasks; we'll c where it goes!

 

Thanks,

Glenn

0 Kudos
Message 4 of 6
(3,582 Views)

Hi Glenn,

 

I know that you already figured this out, but I just want to confirm that you can read from digital lines that you write to in a digital output task.

 

Best wishes,

Wallace F.

National Instruments
Applications Engineer
0 Kudos
Message 5 of 6
(3,568 Views)
Yes, thank u very much.
0 Kudos
Message 6 of 6
(3,561 Views)