LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generating and Acquiring at the same time, DAQ USB-6356

Solved!
Go to solution

Hello,

 

I have an VI how is able to read some inputs with a DAQ USB-6356 and I use a "Agilent 33522A" Waveform Generator. I want to Generate and Acquire with the DAQ.

 

Actually it work but not well, the frequency is not very stable and the 2nd loop didn't stop with the 1st (2nd is Generator , 1st is Acquire).

 

Thanks in advance 😉

 

P.S my VI isn't an true state machine because I need to control it for the moment.

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

Hi MaxLamb,

 

In order to stop two loop at the same time, you can try using local variable.

You can right click at the stop button of one loop and choose create -> local variable. Use this variable to stop another loop.

More information of local variable can be found via this link : https://www.ni.com/docs/en-US/bundle/labview/page/using-local-and-global-variables-carefully.html

 

I'm not sure what do you mean by "not very stable". It would be better if you could explain more on this. If possible please also explain how you connect your hardware.

 

Best regards,

Tuitui

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

Hello TuiTui,

 

By not very stable I mean that I set my generator to 100Hz and I acquire 101.012 Hz.

When I use the Agilent, I set at 100Hz and I acquire 100.004Hz.

 

For the local variable, I can't create one without create a button somewhere ?

 

Thanks you

 

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

Hi MaxLamb,

 

This amount of inaccuracy might caused by various reason. Could you tell me how you read the value of the signal? By using, simulate signal, what is the configuration inside?

 

By using local variable, you need an object in front panel to create one. If you don't want to create an object in front panel, you might want to look at global variable.

Or if you only don't want it to be seen in the front panel, you can hide the control or indicator.

There is a youtube tutorial on global variable which can be found below

http://www.youtube.com/watch?v=PquslTj69f4

 

Best regards,

TuiTui

Message 4 of 10
(3,555 Views)

Hello TuiTui,

 

So, for the Generator :

 

I use 2 "Simulate Signal" wired to a "DAQ analog output". Frequency, amplitude and phase are set by 3 control.

 

Setting of both "Simulate Signal" : Samples per second = 3M , Number of samples = 100k , Run as fast as possible

Setting of DAQ Output : Continuous Samples , Samples to write = 100k, Rate = 3M

 

For the Acquire :

 

I use one DAQ analog input.

 

Setting is : Continuous , Samples to read = 20k (Control in front panel), Rate = 1.25M (Max value)

 

Thanks

0 Kudos
Message 5 of 10
(3,541 Views)
Solution
Accepted by topic author MaxLamb

OK so you are writing at 3Ms/sec and reading at 1.25Ms/sec and you wonder why there is a bit of discrepancy in the resolved frequency?  Ideally you would want the read and write to share a sample clock but at least selecting the same clock frequency (or one that is a multiple of the other) would go a long way to fixing that source of your error.

 

Second source of Error:  You are generating a contineous waveform.  unless you select "integer number of cycles" there is a discontinuity when the end is reached at an arbitrary phase and the phase is reset at the begining of the waveform.  The Write DAQ assistant can "Use Waveform timing" to adapt its timing parameters to the waveform dt and number of samples.


"Should be" isn't "Is" -Jay
Message 6 of 10
(3,534 Views)

Hi Jeff,

 

Yes that was that. But I don't know why I had +10% of frequency when the settings are 1.25MS/s and 3MS/s ..

 

 

 

0 Kudos
Message 7 of 10
(3,514 Views)

@MaxLamb wrote:

Hi Jeff,

 

Yes that was that. But I don't know why I had +10% of frequency when the settings are 1.25MS/s and 3MS/s ..

 

 

 


I'll leave solving the math to you but I'm almost positive you could justify the aliasing you saw by applying the Nyquist-Shannon theorm

 

@and from a previious post the error was @1%


"Should be" isn't "Is" -Jay
0 Kudos
Message 8 of 10
(3,496 Views)

Quick answer : my fault ! the error was 1% .. I just haven't write the number correctly

 

It works really fine now !

 

Thank you Jeff

 

 

0 Kudos
Message 9 of 10
(3,492 Views)

Thanks Jeff

A really helpful information

 

TuiTui

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