LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading multiple channels on oscilloscope

Solved!
Go to solution

Hey there everyone,

 

First of all, thank you for taking the time to read this. I'm still relatively new to LabVIEW but i have read most of the basics.


This question is regarding how VISA's work.

 

I have an oscilloscope that has sensors to 3 channels and i want to display all 3 channels onto the same graph. The example VI that is included with the driver allows me to access one channel however it also adds other functionalities, such as controlling the device which i do not need, i just want to read the data from the oscilloscope.

 

I wont be able to access the equipment for a few days but have begun coding. Below is what i have coded so far.

 

Multiple VISA access.PNG

Read Waveform.PNG Scale Waveform.PNG

 

 

 

The first blue function is "Read Waveform to Array", and the second "Scale Waveform to Array"

 

 

Am i allowed to access the VISA like that? Or is that an illegal access that would cause problems?

I've tried accessing multiple channels before while i was in the lab however they always produced errors.

 

I am using a tektronix TDS2013C oscilloscope , Labview 2013 and have downloaded the relevant driver for my model.

 

 

Any help or links to relative learning tools would be greatly appreciated!

 

-Nam

 

0 Kudos
Message 1 of 11
(8,298 Views)

I do not believe your vi will work as intended. Typically, scopes can only process commands serially, that is, one at a time.

 

Make an array of your sources, then put the two VIs in a for loop. That way you can read 3 channels, however, they will be accessed one at a time.

 

I do not have LabVIEW in front of me to make a sample, so let me know if you need more help.

 

Cheers,

mcduff

Message 2 of 11
(8,266 Views)

Thank you for the reply!

 

I reworked the code as you have suggested and moved the 2 VI's into a for loop. I hope i have done this correctly because it looks (and feels) much better than my previous one.

 

Multiple VISA access 2.PNG

 

I still have no access to the lab to test the code so this will be theory work. I'm not sure whether to have the initialize (white VI) function inside or outside the for loop. Do i want to call initialize every loop or is once sufficient?

 

And another a quick question. What's the difference between a scaled graph data type and a scaled waveform data type? These are my two outputs of the for loop. Since i have them  tunneled into an index, they will
be outputted as arrays. From my understanding if i connect these to a graph they should display every plot onto the graph right? However i feel that the scaled waveform is used for different purposes.

 

Again, thank you very much!

 

-Nam

0 Kudos
Message 3 of 11
(8,226 Views)
Typically, you would only do a single read and do a fetch for other channels. Without looking at the block diagram, the read probably does an initiate so your 3 waveforms would be three separate captures.
0 Kudos
Message 4 of 11
(8,215 Views)

The code looks good, a couple of suggestions:

 

(I do not have access to LabVIEW at the moment.)

 

1.) Make the VISA tunnel a shift register and have it go around the loop. Your code will work without it, but it is good practice.

 

I'm not sure whether to have the initialize (white VI) function inside or outside the for loop. Do i want to call initialize every loop or is once sufficient?

 

2.) Only once at the beginning of the program.

 

What's the difference between a scaled graph data type and a scaled waveform data type?

 

(This is an educated guess here.)

3.) The data downloaded from the scope is probably 16 bit signed integers; this is typically Tek's preferred format. The plot will accurately display what you see on the scope screen. However, you may want to know the real voltage displayed on the scope. This is done by multiplying the integers by a scale and adding an offset, (y = mx + b). I believe this is the scaled waveform.

 

4.) Change the type of Number of Channels to I32; once again it is a good habit to use the correct forms.

 

From my understanding if i connect these to a graph they should display every plot onto the graph right?

 

5) Correct.

 

Cheers,

mcduff

0 Kudos
Message 5 of 11
(8,211 Views)
The code is fine only if you want separate acquisitions and don't care about the relationships between the three.

The dbl array is just the raw voltages. A waveform data type is a basic type in LabVIEW. It contains t0, dt, and the y array. Your graph will display the correct x scale only of you use the waveform.
0 Kudos
Message 6 of 11
(8,197 Views)

Ah okay, that clears alot up about the waveforms.

 

Dennis, i am very interested about the relationship between the three. What should i be changing to fix this?

 

Also, i have changed my channel constant to I32 and fed my VISA back into the loop as suggested by mcduff

0 Kudos
Message 7 of 11
(8,181 Views)

I cannot see the inside of the VIs you are using, but what I believe Dennis is saying is that each vi starts a new acquistion, thus you are reading three different acquisitions along with three different channels.

 

mcduff

Message 8 of 11
(8,161 Views)
Solution
Accepted by topic author Namdu
Please read the manual about a read and fetch.

As I said, the read will initiate a new capture. When you call it 3 times, each returned trace will be later on time than the previous capture. Either do what I said or call a fetch 3 times in succession.
Message 9 of 11
(8,160 Views)

To both Dennis and Mcduff,

 

Apologies if this is reviving an old thread, however i must thank both of you for your time and advice.

 

Its been over a month since i've first started using LABVIEW and i feel that i have progressed pretty far! Through my time in the lab i encountered many bugs, coding issues and general things that were completely wrong. However i went through tutorials, looked at examples, but more importantly, played around with coding myself.

 

Here is what the fetch code looks like now, (and yes Dennis, i encountered the issue with seperate timestamps for each channel which was promptly fixed via your advice)

 

LABVIEW DAQ.PNG

 

Basically, i initiate the oscilloscope then run a loop to display and set each channel's settings. Each channel is then read at the same time, before being compiled into an array and displayed. I hope my logic matches what i coded, but it seems to work exactly as intended so im happy there.

 

Again, thank you for your help

 

-Nam

 

Message 10 of 11
(8,034 Views)