LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Inverting digital I/O polarity using Cdaq

Hey all, 

I am looking to control digital switches. I set up a global channel in NI MAX Digital line output setup, and I can control the switch by clicking the invert line check box and then running it in the NI MAX DAQ Assistant, clicking stop in this mode does not shut the switch off. I have to then un-check the invert line check box and click run again to turn off the switch. From a physical I/O aspect this makes sense to me. What I am having trouble with is that when I make the jump to programming in labview how do I accomplish this with global variables (which I need to use to complete this program). I tried to make two global variables -- one with an inverted line -- and made a case structure with the thought that true is on, false is off. I then found that you can't double up on channels. 

 

Any thoughts? I'd post a pic but I don't really have anything to post. 

0 Kudos
Message 1 of 7
(6,164 Views)

Hi SAMB,

 

running it in the NI MAX DAQ Assistant, clicking stop in this mode does not shut the switch off.

What is the MAX DAQ Assistent? There are testpanels in MAX and there is a DAQ assitent in LabVIEW (AFAIK)…

to programming in labview how do I accomplish this with global variables (which I need to use to complete this program).

You don't need global variables to complete programs…

I tried to make two global variables -- one with an inverted line --

What is a "global with an inverted line"?

made a case structure with the thought that true is on, false is off.

That depends what you are doing in the cases of your case structure…

I then found that you can't double up on channels.

Please explain "double up on channels"…

I'd post a pic but I don't really have anything to post. 

From all my questions it should be pretty clear you have a lot to attach/show…

 

General answer: put your DAQ assistent in a loop. Connect a boolean control to it's input to be able to switch your DO channel.

General answer 2: Usually you are better done without the DAQ assistent. LabVIEW comes with alot of example VIs explaining how to use DAQmx devices and functions…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(6,154 Views)

Thanks,

I tried that, it still won't let me shut the switch off

Download All
0 Kudos
Message 3 of 7
(6,143 Views)

Hi SAMB,

 

so you change a setting/property of a DO (digital output) channel and wonder how to get this done in LabVIEW?

This "inverted" setting is a property of the DO channel. On many DAQmx devices supporting DO channels you can invert the behaviour of those DO channels from standard "TRUE means high voltage" to "TRUE means low voltage". This is extremely useful when controlling hardware, which itself will invert the logic level again. But this is NOT intended as the standard way to set the DO output!

 

To output a value to your DO channel you should use a DAQmxWrite function. To change this "inverted" property in LabVIEW you need to use a DAQmx property node.

Again: check the example VIs coming with LabVIEW. NI provides them to explain all those functions…

Your "air blower" is a shared variable. How is it connected to the DO channel?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(6,137 Views)

Hey the GerdW I must have overlooked the initial red questions in your first post so here it goes....

 

running it in the NI MAX DAQ Assistant, clicking stop in this mode does not shut the switch off.

What is the MAX DAQ Assistant? There are testpanels in MAX and there is a DAQ assistant in LabVIEW (AFAIK)…

Testpannels in MAX

to programming in labview how do I accomplish this with global variables (which I need to use to complete this program).

You don't need global variables to complete programs…

Using Global or shared variable are important in the code because of calculations that need to be preformed in other .Vi's. Using Globals here make my life much easier when getting into the next elements of the program I am tying to code

I tried to make two global variables -- one with an inverted line --

What is a "global with an inverted line"?

One that had the command in MAX for an inverted line and one that had the inverted line box unchecked

made a case structure with the thought that true is on, false is off.

That depends what you are doing in the cases of your case structure

I then found that you can't double up on channels.

Please explain "double up on channels"…

Having one GV (Global Variable) that was the inverted line and the other GV that was not inverted, both were the same channel...LabView didn't like that. 

I'd post a pic but I don't really have anything to post. 

From all my questions it should be pretty clear you have a lot to attach/show…

 

Your "air blower" is a shared variable. How is it connected to the DO channel?

Using a cDAQ 9188 chassis and NI 9485 8-channel Solid-State Relay (SSR) Digital Output module I send a signal to a 24v DC switch to turn on and off a piece of HVAC equipment. When the line is Inverted the equipment turns on and with the line not Inverted the equipment turns off. 

 

Attached is my attempt of creating a vi using DAQmx tasks I tried one version with having a task in and a "lines" the one depicted is just the VI with only the lines input. I got the same error both times talking about Generation cannot be started because the output buffer is empty. 

 

Thanks again!

Also I have to repeat this about 30 times (same type of switch and digital voltage I/O) with other equipment so if there is a cleaner method please feel free to suggest a better method. The goal here is to let the user turn on and off equipment when I finally get to a user interface in the future. 

0 Kudos
Message 5 of 7
(6,102 Views)

I removed the Sample Clock portion, however it wasn't doing anything without the task in so I put one in there. Now I am getting an error that states

 

"Error -200428 occurred at DAQmx Create Channel (DO-Digital Output).vi:6970001

Possible reason(s):

Value passed to the Task/Channels In control is invalid.

The value must refer to a valid task or valid virtual channels.

Task Name: ID Air Blower"

 

I am on highlight exocution and the error is being generated from the DAQmx create channel.

 

 

0 Kudos
Message 6 of 7
(6,092 Views)

Hi SAMB,

 

please attach VIs or snippets instead of images…

 

Where did you define that "ID air blower" DAQmx task? How did you define that task?

Remove those "DO.inverted" property nodes, they aren't needed at all. (I tried to explain that before…)

Why do you try to READ from a DigitalOutput channel? Usually you write to outputs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(6,082 Views)