LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to fix the analog output value for a specific time?

Dear Sir/Mdm,

 

I am very new to Labview programming. My question might be very simple but I really do appreciate if you can give me some advice on the problem I am having.

For your information, I am using NI USB6229, which have the ability to generate voltage of up to 10V. However, what I want to do in my program is as follows; to generate output voltage of 5V when the switch is turn ON and then, the output voltage would stop after 5 seconds.

The problem I am having is as follows, my program seems to work but the output voltage is received is only 1V. Can you advice me on what I should do to amend the program? I have attached the program to this message. 

 

I am current using Labview 8.2 on Win XP.

 

Thank you.

0 Kudos
Message 1 of 22
(3,060 Views)

From your VI it seems you are converting the boolean value to the dynamic datatype used by the DAQmx Express VI. I said it seems you are doing that since there is no wire to the DAQ Assistant.

 

However, when doing that the boolean will be converted to a number, so FALSE = 0 and TRUE = 1. So you write 1V to the Output.

I would suggest you to have a look at the DAQmx examples for Analog Output (Help>Find Examples>Hardware IO ...)

 

 

Christian

0 Kudos
Message 2 of 22
(3,053 Views)

Dear Chris, thank you for the reply. 

 

Does that mean I shouldn't use the boolean switch function for the program?

 

I have referred to Example<Hardware Input and Output<DAQmx<Analog Generation<Voltage<Cons Gen Vol Wfm-Analog start

However, if I understand the example properly, it actually shows the way my DAQ assistant works + the parameters. 

 

I am really sorry for all the questions. It might be simple but I am a little confuse at the moment.

 

Regards,

uranus999

0 Kudos
Message 3 of 22
(3,043 Views)

@uranus999 wrote:

Dear Chris, thank you for the reply. 

 

Does that mean I shouldn't use the boolean switch function for the program?

 

I have referred to Example<Hardware Input and Output<DAQmx<Analog Generation<Voltage<Cons Gen Vol Wfm-Analog start

However, if I understand the example properly, it actually shows the way my DAQ assistant works + the parameters. 

 

I am really sorry for all the questions. It might be simple but I am a little confuse at the moment.

 

Regards,

uranus999


Hey uranus999,

 

I've created what I think will be a simple solution for your code. I've used a while loop to output a random number for 5s at a time upon the press of a button. You'll see that pressing the button has no effect on the loop whilst it's running because While Loops are essentially oblivious to the occurences outside of them, unless you share memory between them by implementation of something like a Local Variable. I'm fairly certain that if you implement this code but in place of the random number you use your DAQ Assistant, you should get the result you want.

 

5sExecution.png

 

The False case does nothing, however if you wanted you could output another signal using your DAQ Assistant, like a 0V signal.

To improve on my code, you could implement some form of Wait function in order to prevent the loop from hogging all of your processor time; but choose a value which is still fast enough to perform non-laggy user interaction. A good GUI timing value to implement would be 100ms.

 

Does this help you?

 

Regards,


Alex Thomas, University of Manchester School of EEE LabVIEW Ambassador (CLAD)

0 Kudos
Message 4 of 22
(3,035 Views)

Something like this may work for you.  Using a standard state machine, you can achieve what you want.  The .ctl file is a strict type def for the enum.  You only need the vi if you want to test it out.  Have fun.

 

Edit:  By the way, I left the relay switch unwired.  I wasn't sure what you were doing here.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Download All
0 Kudos
Message 5 of 22
(3,010 Views)

Dear all, 

 

Thank you for your advice and suggestion. 

I will try it out the suggestions and will give the feedback after that.

 

Regards,

uranus999

 

0 Kudos
Message 6 of 22
(3,002 Views)

Dear Moreese,

 

I am sorry but I have problem in opening the program. I am only having a Labview version 8.2, thus that could be the reason I can't open it.

Is it possible for you to save it at a older version file. 

Sorry about that but I would really appreciate your help.

 

Regards,

uranus999

0 Kudos
Message 7 of 22
(3,000 Views)

Here you go.  You may need to work with the Timer case.  The subtract function may not work with the Get Time/Date fuinction in 8.2 the way it's wired in LV2010.  You can replace this with the Time Delay Express.vi if you wish.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Download All
0 Kudos
Message 8 of 22
(2,994 Views)

Dear Alex,

 

I have tried out your program, replacing the Random Number with DAQ. But it just doesn't seem correct, as the analog output cannot be connected to the DBL. I am attaching the program which I have wrote at the moment (after the replacement). My other question is, I still won't be able to control the output voltage value of 5V, right.

I am really sorry about all the questions.Smiley Sad

 

 

Download All
0 Kudos
Message 9 of 22
(2,958 Views)

Dear MoReese,

 

Thank you for your kind reply.

I have looked at your program and I am wondering. Is it possible for me to use it with my DAQ to generate the output analog voltage signal? 

I am actually wondering where I should put the DAQ and fixed the output analog voltage as 5V.

Sorry if my questions sounds too simple for all of you.

 

Regards,

uranus999

0 Kudos
Message 10 of 22
(2,957 Views)