LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

digital line toggle control

Hi Everyone...

 

I am new to labview, the question that I am asking might be stupid, because it really sounds quite simple, but I just couldn't make it work...

 

I have a NI USB-6509, 96 channels Digital I/O, the project that I am doing is to use it to control several valves of a fluid system. The valves can be controlled by logic signals (e.g. HIGH = valve open, LOW = valve close...etc.) 

 

My idea is to create a generic VI that can control the digital channels of USB-6509, this VI can be used several times in other program, and work independently...for example, if there's a system that requires 3 control valves, three valve control VI icons will be implemented in the control program, each of the VI will have different parameters, toggling pattern and work independently...

 

The VI can be defined into two options: pulse or a periodic signal (switch the valve ON for 2 seconds, OFF for 3 seconds, ON for 2seconds...etc), and the parameters such as frequency, starting time, selecting channel (PORT1 LINE 8...etc) will also be defined in the VI.  If multiple VIs are implemented into one control program, each of them will obviously have different starting time, actions and parameters...

 

The problems that I have met so far are:

1) In my case, multiple VIs are implemented into the same program (there are many I/O lines that need to be toggled), but they are not running in parallel, the program executes the second VI only after the first VI is finished toggleing, so basically the starting time for each VI is messed up...

 

2)The other things that I have noticed is that the parameters for the VI will be affected by other VIs...(I suppose it's because they are the same VIs, the same function is basically called in the same program over and over again...) So when one VI is exeuted, all other VI icon's parameter will be affected...Is there any ways to get around it?

 

 I have struggled so much on this projects, I am now looking at something called `X-control', which might be the solution of this task, can anyone that is experienced with Labview give me some suggestions and feeback?

 

My question description might not be clear enough, please feel free to ask me if there's any description that you don't find it clear, I will try my best to describe it.

 

Many Thanks!!

 

0 Kudos
Message 1 of 5
(2,777 Views)

XControls are for advanced users. I don't think they will help you.

 

Please read through my Action Engine Nugget where I include a small demo of how to control multiple pumps from distinct threads using and AE. Play with that example code to understand how it works. If that approach leaves you wanting post back.

 

Have fun,

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 5
(2,760 Views)

Thanks for your soon reply Ben, I am very appreciated...

 

Two things: 

 

1) I have just read through the Action Engines (AE) page that you gave me,  I noticed that the features of an AE is that it can only be executing in one content at a time...and its shared resource feature. How can I actually implent that into my task...as I want my VIs to start action simultaneously (so I can control each VI's starting time precisly.) I also want my VIs to work independently (so each VI will have their own parameters values, although those variables inside the VI have the same name...)

 

2) Where can I download the small demo code for those AE which can control multiple pumps? I think it will help me understand a lot better with AE's concept.

 

Regards, 

0 Kudos
Message 3 of 5
(2,743 Views)

I wonder if I still have that code on my machine at home.

 

THe AE would serve only to ensure that your single IO device is not being accessed to do diffeent thing at the same time. When the "wheels hit the road" you can only do one thing at at time with an interface. The rest of your code would still be broken up into seperate loops or VIs.

 

Since I can't guarentee that example is still around I don't want you to hang waiting for it. Start putting together a simple example and ip it up and post so we can review and advise.

 

Still, just trying to help,

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 5
(2,728 Views)

Hi hykwei,

 

I would recommend looking at some of the DAQmx shipping examples such as Write Dig Chan.vi. Something along those lines in a subVI where you pass in the lines you're writing to would probably be ideal for writing to your valves.

Jeff | LabVIEW Software Engineer
0 Kudos
Message 5 of 5
(2,713 Views)