LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Powering an electromechanical relay with an NI-9481 module.

Here's a LabVIEW 8 version.
Ryan D.
District Sales Manager for Boston & Northern New England
National Instruments
0 Kudos
Message 21 of 32
(2,120 Views)

Hi,

 

Sorry for the big gap in time, but I have been reading through this posting and it is exactly what I want/need to do with my program. However, I have two PXI-2564 SPST relay cards that I want to control instead of the 9481 module listed above.

 

Is it possible to use the "check marks" on the front panel to control the relay boolean OPEN/CLOSE state?

 

Thank you for your time.

 

Henry

0 Kudos
Message 22 of 32
(1,955 Views)

Hi Henry, 

 

Could you please clarify what you mean by "check marks"?  Thanks Henry.

 

Brandon Treece

Applications Engineer

National Instruments

0 Kudos
Message 23 of 32
(1,932 Views)

Hi Brandon,

 

If you take a look at the attached vi by LabViewGuru, in the setup box he has Cycle 1 Relays, Cycle 2 Relays, etc to set the state of each relay for each seperate loop iteration. If I am not mistaken, we can interpret that as relays 1, 2, 3 control for open/close functionality. Hence a check mark will be "Closed" relay.

 

I know that the 9481 is similar to the 2564 since they are both SPST type relays, but I am not sure how he was able to control multiple lines using the DAQmx Digital Output Write commands (in each cycle there are case structures that he uses to write to the multiple relays.) If you are able to explain that portion to be, that will be helpful as well.

 

If I made you more confused as I am now, please let me know and I will try to clarify again. Thanks in advance for your help.

 

Henry

0 Kudos
Message 24 of 32
(1,924 Views)

Hello Henry,

 

You can control multiple lines (port) by using DAQmx Write.  Prior to setting the relay conditions in DAQmx Write, a task must be initialized and set.  I am assuming (I was having difficulties referencing this file) that "Pump Automation 1.vi" sets the task since it is the vi prior to DAQmx Write.  A good example that explains the process can be located at the example finder then selecting Hardware Input and Output -> DAQmx -> Digital Generation -> Write Dig Port.vi.  Changing the relay condition is similar to digital generation.  I hope this example helps.

 

Regards,

Roman S

 

Regards,
Roman Sandoval | National Instruments | RF Systems Engineer
0 Kudos
Message 25 of 32
(1,899 Views)

Hi Roman,

 

Thank you for leading me to the Write Dig Port.vi example. I did not know you can treat the relay controls as a digital output.

 

Is there a way to initialize all 16 relays to false without having to click the last relay? I tried to modify the example and set a for loop to initialize all 16 channels but it always default to 8 initialize on initial startup (8 lines activated, last 8 lines are grayed out). This will always cause a failure on the first run, after that it always works.

 

 

Henry

Download All
0 Kudos
Message 26 of 32
(1,855 Views)

@Henrytran wrote:

Hi Roman,

 

 

Is there a way to initialize all 16 relays to false without having to click the last relay? I tried to modify the example and set a for loop to initialize all 16 channels but it always default to 8 initialize on initial startup (8 lines activated, last 8 lines are grayed out). This will always cause a failure on the first run, after that it always works.

 

 

Henry


Once you have gotten all 16 elements set to false, right click on the array control and pick Data Operations > Make Current Value Default then save the VI.  Now the default state upon opening the VI will be a 16 element array of falses instead of an 8 element array.

 

The way you are trying to initialize the control now won't work because you have a race condition.  The control terminal for the array may (and probably will) get read before the For Loop runs and places its value into the property node for that array.

0 Kudos
Message 27 of 32
(1,847 Views)

Thanks,

 

That's weird that "Make Current Value Default" does not work from the Front Panel. I've been doing that all day without any luck and I tried once from the block diagram and it works. I wonder if that is a bug in LV2010 f2 because I know it works in LV8.6 and 2009.

 

Thanks for your help anyways.

 

Henry

0 Kudos
Message 28 of 32
(1,841 Views)

@Henrytran wrote:

Thanks,

 

That's weird that "Make Current Value Default" does not work from the Front Panel. I've been doing that all day without any luck and I tried once from the block diagram and it works. I wonder if that is a bug in LV2010 f2 because I know it works in LV8.6 and 2009.

 

Thanks for your help anyways.

 

Henry


It works just fine for me in LV2010 f2.  My guess is that since it is an array, you were just right clicking on the wrong part of the structure.

 

0 Kudos
Message 29 of 32
(1,837 Views)

Hello Henry,

 

A port typically consists of 8 lines (0:7).  So when you initialize 16 lines of a port (0:15), you are actually initializing 2 ports.  With that said, you should specify your channel parameter to "PXI1Slot12/port0/line0:7,PXI1Slot12/port1/line0:7" instead of "PXI1Slot12/port0/line0:15".  I hope this helps.

Regards,
Roman Sandoval | National Instruments | RF Systems Engineer
0 Kudos
Message 30 of 32
(1,814 Views)