12-06-2007 02:15 PM
11-22-2010 06:11 PM
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
11-23-2010 05:29 PM
Hi Henry,
Could you please clarify what you mean by "check marks"? Thanks Henry.
Brandon Treece
Applications Engineer
National Instruments
11-23-2010 06:04 PM
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
11-24-2010 04:59 PM
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
12-06-2010 07:13 PM - edited 12-06-2010 07:17 PM
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
12-06-2010 07:49 PM - edited 12-06-2010 07:52 PM
@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.
12-06-2010 08:06 PM
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
12-06-2010 08:42 PM
@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.
12-07-2010 03:56 PM
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.