LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

generate constant voltage under Specifying Conditions

 Good afternoon everyone!!!

 

We are now using labview to generate constant voltage.

I've found an example and did some change to fit our project. We need to output a dc voltage only when one of our voltage input is between 5V and 7V. I try to use a case structure to achieve it.

 

When increasing my input voltage bigger than 5V, program inside the case structure can generate a dc voltage. But when I decrease my input (less than 5V), case structure won't stop run and even remains generate dc voltage.

 

Another question is the stops  inside the while loops. I have two while loops, one is inside the case structure(stop 2). The original stop control 2 for this while loop is

p.png

But I want to use another stop button(stop 1) to control the whole program so I connect stop 2 with stop 1, is it can??

 

I've attached my vi. here. Could anyone tell me where is my error and how should I solve it !!

Millions of thanks !!!!!!!!!!!!!!!!!!

 

0 Kudos
Message 1 of 17
(3,393 Views)

Could you post your VI in 2012

Munna
0 Kudos
Message 2 of 17
(3,379 Views)

Sorry I only have 2013 version.....

here is my printscreen for whole vi.

f.png

0 Kudos
Message 3 of 17
(3,371 Views)

you can save VIs to previous version using file - save for previos version.

But still here your issue is that you dont understand data flow

your inner loop( inside case structure ) is never going to stop because it is getting value of stop from outside.

Remove the inner while loop. 

and you should be doing your DAQ configuration outside the main while loop.

0 Kudos
Message 4 of 17
(3,361 Views)

Generally when you apply voltage to your DAQ card your Sample and Hold amplifier will hold the data (Correct me if I am wrong) until another value is written. So when I/P voltage is between 5V to 7V you are applying DC voltage and when it is not within that limit you are doing nothing, so the last value whatever you set will be held. If you want to bring that back to 0 when your I/P voltage is not within limit then write 0 in the false case (writing once is sufficient.

You can pass the Stop wire from the inner loop to the outside loop stop terminal.

 

Suggestion: Restructure your code, you cannot initialize and close inside a loop which will end in timing and other issue.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 17
(3,360 Views)

Sorry I make a mistake. We wnt it to generate the output when I/P less than 5...when as O/P genetation voltage our I/P will increase also. When I/P increase to 7V, then stop O/P generation.

Then I/P will decrease and when it less than 5V the case structure will on again...

0 Kudos
Message 6 of 17
(3,341 Views)

I try to save it as previos version and did what you said~

Here I attach my vi. You see whether it can use or not~~

And sorry I make a mistake. We need to generate constant output when I/P less than 5V and stop generation until I/P increase to 7V...

 

 

 

0 Kudos
Message 7 of 17
(3,334 Views)

Then develop your code in this was

 

1. Initialize the DAQ

2. Start the task

3. Inside loop

  • Check Voltage
  • I/P less than 5V apply the required voltage
  • I/P greater than 7V apply "0V" and stay idle

4. Outside the loop Stop the Task and clear.

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 8 of 17
(3,333 Views)

Sorry I think  here we get an error.

We will detect our I/P all time. When it is less than 5V, we need to start genarate O/P till I/P increase to 7V and then stop generation. In this process, even I/P is between 5-7, the case structure is still on.

When I/P is more than 7, generation will stop and this time, our I/P starts to decrease....Only when it is less than 5V, we need to start generation for another loop...

 

 

Sorry I don't know whether I express clearly my meaning....TuT

 

 

0 Kudos
Message 9 of 17
(3,324 Views)

Here is Simple snippet.

 

You need to takeout your O/P from Case structure.

DAQ.jpg

Munna
0 Kudos
Message 10 of 17
(3,312 Views)