LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how can i generate 10ms long sine signal?

Solved!
Go to solution

Hi everyone,

 

I'd like to do next: generate a sine or DC signal for a specified amount of time, 10 ms i.e. After that, I want my outputs to be grounded, till next time I run the program. I'm using DAQ Assistant and 6211 DAQ.

 

Any help or advice will be great!

 

Best regards,

 

 

Pero

0 Kudos
Message 1 of 10
(3,806 Views)

OK. Doesn't sound that hard. What are you having problems with? Have you looked at the examples that ship with LabVIEW? They don't use the DAQ Assistant, as they use the DAQmx VIs directly (which is what the DAQ Assistant does internally).

0 Kudos
Message 2 of 10
(3,797 Views)

You have to define your sample rate and the number of samples to generate.  For example, with a sample rate of 1000 samples per second, it would take 1 second to generate 1000 samples.  If you specify to generate 100 samples, that would take 0.1 seconds (100mS).  If you specify 10 samples, that would take 10mS.  So you should figure out the sample rate and number of samples to generate in order to generate 10mS worth of signal.  Your frequency would have to be properly set for the sample rate you choose.  Hint: use a higher sample rate to generate enough points to create a smooth sine wave.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 3 of 10
(3,784 Views)

Ok, that sounds fine. But I need to know how the DAQ Assistant behaves when there is another DAQ assistants in the program. I.e. one DAQ assistant generates analog signal, 200k samples at rate 200kS/s,and the other one acquires the same amount of samples at the same rate. Well, are they working parallel or, one after another (sequential) ?

 

One more question:

I tried your method of generating specific number of samples. When I press "run", signal last for desired interval, and then drops to the ground.

But when I press "run continuously",  it repeats periodically. One period consists of interval when pulse exists and interval when output is zero. How can I calculate duration of period (execution frequency in "run continuously" mode ) and interval when output is zero?

 

Thanks for help, your advices are really helpful,

 

Pero

0 Kudos
Message 4 of 10
(3,762 Views)

 


@pero_kr wrote:

Ok, that sounds fine. But I need to know how the DAQ Assistant behaves when there is another DAQ assistants in the program. I.e. one DAQ assistant generates analog signal, 200k samples at rate 200kS/s,and the other one acquires the same amount of samples at the same rate. Well, are they working parallel or, one after another (sequential) ?


 

You can only have one task type running at a time. This means you can have only one analog input task running. However, you can have an analog input and an analog output running simultaneously. This is a hardware limitation, not a software one.

 

 


One more question:

I tried your method of generating specific number of samples. When I press "run", signal last for desired interval, and then drops to the ground.

But when I press "run continuously",  it repeats periodically. One period consists of interval when pulse exists and interval when output is zero. How can I calculate duration of period (execution frequency in "run continuously" mode ) and interval when output is zero?


You should not be using the Run Continuously button. This just restarts your program from the beginning. It is meant to troubleshoot VIs and debug them - it is not meant to be used for normal operation. You should have a loop in your code that keeps the code running until you press a "Stop" button on the front panel.

 

0 Kudos
Message 5 of 10
(3,751 Views)

 


However, you can have an analog input and an analog output running simultaneously.

 

 


 

That's what I needed to know. Thanks.

 

 

 

 


 

You should have a loop in your code that keeps the code running until you press a "Stop" button on the front panel.

 


 Ok, but how long it takes to make an single iteration of the loop?

 

0 Kudos
Message 6 of 10
(3,743 Views)

Labview is shipped with tons of examples to to study. Go to help in the toolbar then select Find Examples. Do a search for your topic. Search for DAQ and look for examples starting with "cont acq" or "cont gen". Use the shipped examples as your Labview tutor. Instead of goofing around with Express VIs deluding your self into think you are doing any great Labview programming 



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 7 of 10
(3,738 Views)

 


Ok, but how long it takes to make an single iteration of the loop?


I don't understand your question. The only time this would matter is if you're doing software-based timing of your analog generation, and it doesn't sound like you're trying to do that anyway.

 

0 Kudos
Message 8 of 10
(3,728 Views)

Let's say I have a while loop in my program. When I press "run" the loop executes over and over again, untill stop condition happens. How long (in miliseconds, microseconds or nanoseconds) takes for my PC to do operation in just one iteration of the loop?

 

Hope this time a make myself clear. Thanks a lot for help.

0 Kudos
Message 9 of 10
(3,721 Views)
Solution
Accepted by pero_kr

 


@pero_kr wrote:

Let's say I have a while loop in my program. When I press "run" the loop executes over and over again, untill stop condition happens. How long (in miliseconds, microseconds or nanoseconds) takes for my PC to do operation in just one iteration of the loop?

 

Hope this time a make myself clear. Thanks a lot for help.


 

That depends entirely on what's inside the loop and what else your computer is doing, and what operating system you are using. You cannot create a deterministic loop with a non-deterministic operating system like Windows. A loop iteration could take 5 msec or it could take 5 seconds if the OS thinks it has to go off and do something ultra-important, like update your computer to fix all those security holes that Windows has. You can use timed loops but those are not guaranteed to run at exactly the frequency specified since you are at the mercy of the operating system.

 

I still don't see why this information is important to you. Have you done as suggested and looked at the examples that ship with LabVIEW and get installed with DAQmx? They show you how to do continuous generation.

0 Kudos
Message 10 of 10
(3,718 Views)