LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Generation and acquisition of two different signals simultaneously in Labview

Solved!
Go to solution

Hello all,

I hope some of you may help me with LabView. I am completely new to Labview.

I am able to generate a triangular wave in Labview as an input to an amplifier. Now I want to acquire the output simultaneously. I don't know how to sync these two so that a single block diagram with read and write function can achieve the aim.

Please pitch in some way I can use as a guide.

Thanks.

Pieterson

 
 
0 Kudos
Message 1 of 7
(2,852 Views)

Since you are new to LabVIEW, I'll assume you are also new to the Forums, and have not read the Unofficial Rules of the LabVIEW Forum (that might not be the correct name, and I can't find it right now ...).  We are eager to help, but you need to "help us to help you", specifically by attaching your VIs or LabVIEW Projects to your posts.  If you have more than about 3 VIs (as in a Project), compress the folder that contains them and attach the resulting .ZIP file.

 

By looking at your VIs, we can tell (and respond appropriately to):

  • What Version of LabVIEW you are using;
  • What LabVIEW concepts you seem to understand;
  • What LabVIEW concepts you don't seem to understand;

Some other information that would be extremely helpful is to know what hardware you are using to generate the waveform to the amplifier, and what you are hoping to use to acquire the data.  What are the parameters of the waveform(s) -- how many samples/second are you generating, for how long are you generating outputs and sampling inputs, etc?  How many channels?  [Note that some of these questions should be obvious to us by looking at the code, yet another reason to Attach the Code].

 

Please do not make the "mistake" of (only) attaching a picture of the Block Diagram -- some of us "go ballistic" (I confess to being one of them) when there is only a picture, and refuse to look at it.  [On the other hand, if all you have is a phone, pictures are "nice" ...].

 

Bob Schor

0 Kudos
Message 2 of 7
(2,821 Views)

Thank you Bob_schor.

Here I am attaching the snapshot of the block diagram. I am using NI9263 for analog output/generation of signal and will use NI9215 to acquire the output signal of the amplifier. The hardware is NI-cDAQ 9172.

           Labview version 2014(32 bit)

#SAMPLE=1000

RATE=1000

1 CHANNEL FOR INPUT AND EXPECTING ONE OUTPUT CHANNEL TO ACQUIRE.

I would like to focus that I am able to generate the signal, feed it to the amplifier and see the input and output on an oscilloscope. Now, I want to acquire that output in LabVIEW simultaneously.

Regards,

Pieterson

 

 

0 Kudos
Message 3 of 7
(2,805 Views)

Thank you for attaching a picture.  As I said in my previous post,

 

"Please do not make the "mistake" of (only) attaching a picture of the Block Diagram -- some of us "go ballistic" (I confess to being one of them) when there is only a picture, and refuse to look at it.  [On the other hand, if all you have is a phone, pictures are "nice" ...]."

 

I have not (and will not) look at the .jpg (if you're going to attach an image, a .png is often easier to see), but will wait for the .vi (for reasons I thought I explained).

 

Bob Schor

0 Kudos
Message 4 of 7
(2,789 Views)

Thanks again Bob_Schor,

Sorry about that. Here I am attaching .vi program.

 

Pieterson

0 Kudos
Message 5 of 7
(2,777 Views)

Hi Pieterson,

 

in your LLB there are only VIs to generate an AO signal, but no VI to read an AI signal…

 

Did you search for example VIs in the example finder?

There are also example VIs explaining how to sync two DAQmx tasks to start at the very same time…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 7
(2,774 Views)
Solution
Accepted by topic author Pieterson

Thank you for attaching your code.  Here are some comments:

  • When I started with LabVIEW, it was LabVIEW 7.0, and a number of the VIs I "inherited" were in .llbs.  I, myself, have never used a Source Distribution (.llb), and they seem to be going "out of style".  You might consider extracting the two VIs in the .llb and removing the extra "layer".
  • I notice that your gen_Trapezoid is in LabVIEW 7.1, while a.vi (surely you can find a more mnemonic name!) is LabVIEW 2014.  It appears you might not be using gen_Trapezoid ...
  • See if you can wean yourself from using Express VIs and Dynamic Data Wires.  The Waveform Palette has numerous examples for generating Waveforms which form "natural" data constructs for A/D and D/A DAQmx Read/Write functions.
  • I recommend reading Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications.  Among other things, I think it will explain that you don't need a "Wait (ms)" function inside a DAQmx Read or DAQmx Write While Loop -- the DAQmx Read/Write function, itself, will "clock" the loop according to the timing of the DAQ Read/Write function (i.e. if you are reading 1000 points at 1 kHz, the DAQmx Read will take 1 second, based on the un-interruptable crystal clock in the DAQ hardware, probably more accurate/precise than the millisecond Clock used by the Wait function).
  • So here is a question about "simultaneous" -- suppose you could "magically" do the DAQmx Read and Write at exactly the same CPU Clock.  This doesn't mean that by the time the DAQ hardware fires the D/A and A/D converters, the times will be the same.  What you should be able to do is to "do your best" to start them in synchrony, and measure the discrepancy between reading and writing (by sampling, for example, a Pulse generated with, say, a delay of 10 ms and sampling the output, seeing when the Pulse occurs).
  • Look at the DAQmx examples -- I'm pretty sure I've seen examples showing attempts to synchronize multiple DAQmx tasks.

Bob Schor

0 Kudos
Message 7 of 7
(2,756 Views)