Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Status of Digiatal output lines

I've written a vi to control 6 solenoid valves, via their associated solid state relays. I am using port 0, line 0-5.  I want to turn on Solenoid 1 for a given time (i.e 30 seconds), then turn it off and turn on solenoid 2, etc.  I'm using a stacked sequence to acomplish this.  The problem is that with this approach, I can't figure out how to monitor the status of the solenoids.  If I place an indicator on the first solenoid signal in frame 0 and the second solenoid signal in frame 1, etc, the indicator obviously won't shut off when the sequence frame is done, even though when the vi advances to frame 1 (2nd frame), the output 0 goes to 0V.  Any ideas?
0 Kudos
Message 1 of 32
(5,063 Views)
That is an awfully complex VI for such a simple task. Look at the attachment and see if it does what you want. You will also notice that the program does not create and start a DAQmx task umpteen times and that you can actually write all lines at once.
0 Kudos
Message 2 of 32
(5,049 Views)
Dennis,

Great suggestion - much more efficient! In addition, if you wish to verify that your digital lines are not being pulled away from the state you are driving, you can perform a digital read on that same task. It doesn't just read from a register - it reads the actual state of the lines. You can also program LabVIEW to make sure that the data is the same, and signal you if it is not.

Hope this helps,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 3 of 32
(5,038 Views)

Dennis and Ryan, thanks for all of your help.  I've actually not encountered a situation where I needed to build a boolean array, so this was new ground for me.  I still have a couple of questions though:

Dennis:

When I run your vi, it faults out after the 6th iteration.  I get the message:    Error – 200324 occurred at DAQmx Start Task.vi.  Device not available in NI-DAQmx.  It is possible that the device is being used by Traditional NI-DAQ or that the device is being reset.  I thought I just needed to modify three things.  I altered the Lines input to the DAQmx Create Channel, changing it from 0:7 to 0:5, as well as deleting the 6th and 7th columns from the array, since I only need outputs on lines 0-5 (6 total solenoids).  Additionally, I deleted the last two Data Written indicators, again because I only need 0-5.  No luck.  I still get the same error.

 

Ryan

 

When I run your vi, I can’t see anything at all happening.  None of the LEDs illuminate, and the vi faults out after about 12 seconds (I have the measurement duration set for 2 seconds in order to test the vi.  I’ve also saved a version of each of your vis, having replaced the Boolean controls with an array.  Again, this is the first time I’ve used a Boolean array as an input.  I’m just embarrassed to be struggling with what you two are proving is a VERY simple application.  Please forgive my extreme ignorance.

0 Kudos
Message 4 of 32
(5,031 Views)
One more question guys...how DO you create a boolean array in the first place?  I can't find any help on this?
0 Kudos
Message 5 of 32
(5,030 Views)
OK, the "Stupid alarms" are going off all over the place.  My mistake.  I had to change deveice 1 to deveice 2 in the vi.  So that is sorted out. Ryan, I'm not sure why your vi worked differently than Dennis' (the LEDs did not illuminate on your's until I changed the device number, while in Dennis' they did, even though both faulted out at the same point. ANYWAY, both seem to work ok now.  My only questions are...again, how did you build the boolean array in the first place?  Where is there an example that shows how to do this (for example explaining that the columns represent bits, while the rows represent iterations).  The other main question I have is:  is there a simple way to set the last bit (5) low before ending the vi, so that the LED goes out?
0 Kudos
Message 6 of 32
(5,024 Views)