Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Find current voltage of AO

Hello, 

 

I'm writing a program to simultaneously measure and output two voltages from a DAQ card. The program needs to use the current value of the output to compute information from the two inputs; however, the sampling rates of the inputs and outputs are different (MHz vs. KHz). Right now, I'm using three loops: one for reading, one for writing, and one for data analysis, with a queue to send data from the read loop and one to send data from the writing loop. This has been working, but recently the delay between the start and end of the sample buffer for the writing loop has become a problem, since the way the processing loop just takes the last value that will be written to the card rather than the value that's just been written, which may be quite different. I have foudn some documents related to synchronization but they seem to be related to synching external equipment to the card vs. the computation with the card.

 

Question: Is there some way to tell, inside of the "processing" loop, since it is running much faster than the output loop, what the current value of the outputs are? Or, alternatively, compare the waveform data being written to the current time to figure out what the output is supposed to be at a specific iteration of the processing loop?

 

Other information:

Using waveform data types, no regen on output task, continuous sampling. 

 

Attached is a basic diagram of the current progam (clearly not the actual program, just the idea.)

0 Kudos
Message 1 of 7
(4,700 Views)

The simple answer would be to just use another AI channel to sample the applied voltage.  It will always be in sych with the other analog inputs since you should have them all in the same task.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 7
(4,692 Views)

Hi Crossrulz, thanks for the reply! I had thought of that too, but I'd like to avoid it if at all possible. I've found problems before with the DAQ cards sampling signals with different common-mode voltages before, and it seems like a waste to sample those channels at such a high rate when the signal being written is slow. 

 

Any ideas about how I could implement it within Labview?

0 Kudos
Message 3 of 7
(4,687 Views)

Have a look at the shipped examples for sync'ed IO ....

Setup the tasks for continous read an write, share the same timebase, start with a triggered IO  ... 

since you know what you are sending and you have the timestamp of your readings, you can determin what the output "should" have been...

 

I I have the channels I would also read my exitation ....  decimation is fast 😉

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 4 of 7
(4,659 Views)

What about changing the AI task to read the internal AO signal (eg _ao1_vs_aognd for AO1) in addition to the input signal ?

 

See here and here for more details.

0 Kudos
Message 5 of 7
(4,652 Views)

Hello Henrik, 

 

Thanks for the help! I didn't see anything in this document about doing sync'd IO with different sampling rates: 

 

https://www.ni.com/en/support/documentation/supplemental/06/timing-and-synchronization-features-of-n...

 

I did see something about it in this document (specifically, section 5) but I don't know if it would apply to my PCIe-6361:

 

https://www.ni.com/en/support/documentation/supplemental/21/signal-based-synchronization-of-analog-i...

 

Do you know if/what would have to change for it to work with my device?

0 Kudos
Message 6 of 7
(4,623 Views)

Hi JB, thanks for the info! I didn't know about the internal AO signals. Am I correct in thinking that it's a cleaner way to measure the AO with an AI instead of running an external wire?

 

Dang, I thought I posted this message like two days ago but it didn't go through...

0 Kudos
Message 7 of 7
(4,590 Views)