LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

set up time for ni 6501 to control relay

Solved!
Go to solution

Hi,all

 

I have made great progresses with your help. Right now I know how to control the relay using NI 6501.

 

Furthermore,  I try to set up a time period (after 2 hours) and then let NI 6501 switch on the relay.

 

What kind of example can I refer to?

 

Another control is when pressure data is low to 1mtorr, then switch on relay.

 

If there are some similar examples I can refer to, it will be helpful for me programming

 

 

Thanks

0 Kudos
Message 1 of 20
(4,537 Views)

Hi Mylong,

 

If you are looking to wait for a certain amount of time before the 6501 controls the relay, I would recommend using a sequence structure with elapsed time so that you wait for a selectable amount of time before executing your 6501 code.

 

If you are looking to trigger control based off of pressure data, you would need an external trigger or you would need some way to read the pressure.  In hardware, you can use a pulse on the PFI0 line on the 6501 to trigger output to the relay.  In software, if you can read pressure data, you can check until it reaches a certain threshold and then switch using a case structure.

 

As for an example, it will depend on what you are looking to do with the pressure data and where you are receiving it from.  If you can clarify how that data is coming in, I can steer you in the right direction.  Thank you!

Kyle A.
National Instruments
Senior Applications Engineer
0 Kudos
Message 2 of 20
(4,503 Views)
Thank you so much. We can collect pressure data with time using Labview. I will try to use case structure. I have four relays to control. When pressure is lower to 1mtorr, relay 1 and 2 need to be switch off, but relay 3 and 4 need to be swith on meanwhile.  
0 Kudos
Message 3 of 20
(4,491 Views)

Here is a small example of how to use a Case structure to turn relays on and off.

 

- tbob

Inventor of the WORM Global
Message 4 of 20
(4,480 Views)

Hi

Tbob

Thank you so much!

But you version is 2009. I canot open it.

0 Kudos
Message 5 of 20
(4,460 Views)

I checked the example cannon-trig.vi. It is helpful for my program. Next step I plan modify it to use in my program. The basic idea for my program is

 

firstly I try to use NI6501 to switch on solenoid valve 1 and 2 at the same time. Meanwhile, PR4000 is been programed to monitor the system pressure. When the pressure is down to vaccuum state, V1 and V1 should be switch off, then V3 is switch on. Also PR4000 began to write the pressure data into text file. After two hours, V3 switch off, then V4(vent valve )is switch on quickly release the system pressure then switch off quickly.

 

Right now I know how to control solenoid valve and collect data from PR4000. next I need to integrate them together. Synchronization is important for me.

 

Could you give me more hints?

 

Thank you so much.

I really learn much from NI forum

0 Kudos
Message 6 of 20
(4,445 Views)

Here is an example of how to control your valves:

 

ValveControl.png

 

This example is not ideal.  For example, the Write to Spreadsheet File is called each loop iteration just to write only one value.  This is a waste.  It would be better to collect all your data into an array (use a wire to loop edge with indexing on), and call the Write function once with an entire array of data.  I will leave it up to you to do this.  You could use the practice.  Another thing is that a lot of local variables are used.  Also not ideal.

 

Also, a state machine architecture would serve this purpose much better.  First state would be similar to the first sequence frame.  Second state would be like the while loop.  And so on...  See if you can implement this code in a state machine.  One advantage would be to control each stage of the code in an orderly manner.  Another advantage would come if you ever had to change the order of execution, or insert code in between states.  Just add a new state and/or change the next state pointer.  Local variables can be replaced by shift registers in a state machine, leading to the code being easier to read.  See if you can do this.

 

- tbob

Inventor of the WORM Global
Message 7 of 20
(4,419 Views)

tbob,Thank you so much!

 

I have tried to use elapsed time to let program running 2 hours. But when program is running, if I want to increase the runing time from 2 hours to 3 hours.How should I do?

 

For other control, I'd like to change the control like data acquiration speed and time when runing the program. I do not know how to do it. Further, when runing the program. I want to pause the data collection then resume it. Could you give me some advice?

 

Thank you .

 

0 Kudos
Message 8 of 20
(4,399 Views)

You are asking for a lot of things.  Lets take one at a time.

 

If you want to change your waiting time "on the fly", you cannot use the Elapsed Time function.  You need a loop that does nothing but delay for one second.  You need a time control (I32) to set the number of seconds to delay.  Write the code such that the time control is inside the loop.  Put a delay with 1000 mS wired to it inside the loop.  Stop the loop when the i terminal is greater than the time control.  Try writing this and put it into your code at the proper place.  Then we will procede to the next problem.

 

Actually, by doing this you may learn how to change the acquisition speed on the fly.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 9 of 20
(4,380 Views)
Thank you , I will try
0 Kudos
Message 10 of 20
(4,367 Views)