Jump to content
  • 0

analog discovery2 labview


kenken

Question

Excuse me for being busy.
I am a Japanese university student.
This is a question about labview.
There are two problems with the current program.
One is an arbitrary waveform generator with an amplitude of 5V, but on the front panel it is 5V or higher.
It has become. I want you to tell me why.
The other is that the acquisition time is 500ms, but 500ms is not acquired.
Why.
Thank you for your patience.

 

 

スクリーンショット (1).png

スクリーンショット (2).png

Link to comment
Share on other sites

Recommended Posts

Hello,

T means True and logic 1, which is a high level on your DIOs.

F means False and logic 0, which is a low level on your DIOs.

Pretrigger time is just the time the oscilloscope input acquires signal before the actual pulse is generated; this can be useful in case you want to see an event or noise before the actual pulse.

Yes, the "Wait for 20ms between reading the data and displaying + saving it." records the waveform 20ms after acquiring the waveform.

Best Regards!

Link to comment
Share on other sites

Hi kenken,

I'm not sure I understand your problem. Do you want to wait for 20ms between reading the waveform and displaying it in the VI?

Or do you want to acquire data using the oscilloscope input 20ms after the pulse has been generated?

The case where the pulse wave is not displayed on the oscilloscope refers to the triggering problem I mentioned in my previous post. I contacted a colleague bout this, and hopefully we will have a solution soon.

I have another question: which of the two attached VIs did you use: 1202_1.vi or 1202_2.vi?

Best Regards!

Link to comment
Share on other sites

Sorry for not understanding.

I want to wait for 20ms between reading the waveform and displaying it in the VI.

I also think there is a problem with the timing of trigger and waveform acquisition. If the desired waveform is displayed on the oscilloscope, the experiment system you want to create is completed.
I'm waiting for a warm comment from your colleagues.

I used both files. However, both displayed similar waveforms.

Thank you for your question.

 

Link to comment
Share on other sites

Hi kenken,

In order to wait for 20ms between reading the waveform and displaying it in the VI, you can simply add a "Wait (ms)" LabVIEW function with 20ms at its input, inside a flat sequence structure, on the wire going to the Waveform Graph. I did this in the attached VI.

Also, in your VI the pretrigger time was too large (500ms, when the entire acquisition time was 500ms); there was no way to see the pulse with that pretrigger time setting.

Finally, before generating the 1ms pulse, you need to wait for the pretrigger time to elapse, so that Analog Discovery can read the corresponding pretrigger samples.

I fixed this in the attached VI, and set the pretrigger time to 100ms; any setting smaller than the acquisition time should work.

Best Regards!

1202_1_edited.vi

Link to comment
Share on other sites

Thank you for your reply.
Thank you for your kindness.
I would like to make adjustments for next week's experiment.

I have a question about the program.
I'm sorry for not knowing where the attached photo is circled.
Mainly about pulse wave program.
I am sorry for my lack of knowledge.
Thank you.

スクリーンショット (48).png

Link to comment
Share on other sites

Hi kenken,

If you look at your screenshot, from left to right:

- The first circled item is the initial value for DIO14 and DIO15 (F = false = logic 0); you can leave it the way it is;

- The second circled item is a flat sequence with a delay time inside; the value of the delay time is given by a local variable called "Pretrigger time (ms)", which takes its value from the front panel control with the same name. This delay is necessary so that the oscilloscope input has time to acquire the samples corresponding to the pretrigger time (i.e. the time before the rising edge that you trigger on). You can leave this the way it is too. However, you can change the value of the front panel control called "Pretrigger time (ms)", to adjust the position of the pulse on your front panel waveform.

- The third item is the high value of the pulse on DIO14 and DIO15 (T = true = logic 1); you can leave it the way it is;

- The fourth item is a delay corresponding to the pulse duration, in ms. Now it is 1ms, but you can change it to other values as well.

- The fifth item is the final value of the pulse (F = false = logic 0). You should leave this too the way it is.

Best Regards!

Link to comment
Share on other sites

Long time no see.
Thank you for your reply.
Could you confirm it because I tried to interpret the reply you received before?

・ T and F represent 1 or 0 in terms of logic, that is, whether or not to generate a pulse.

・Pretrigger time makes it easy to see the target waveform by displaying the waveform after the specified time.

・ "Wait for 20ms between reading the data and displaying + saving it." Records the waveform 20ms after acquiring the waveform.

Thank you for your reply after confirmation.

Link to comment
Share on other sites

Hi kenken,

I'm sorry for the delay in answering you.

Generating a pulse using the digital outputs would look like in the upper part of the attached VI (see comments in the VI block diagram for details).

However, using this method you would not be able to control the width of the pulse very accurately, as this is controlled by software. A desired 1ms pulse width could end up being 0.5ms or 2ms in reality.

Because of this, I recommend using the method described in my previous post above (Using Waveforms SDK and LabVIEW, for example), for which the timing is controlled by hardware, and it is therefore more accurate.

Please note that for the VI attached to this post, there is also another problem: triggering on the oscilloscope input channels does not work when looping back the digital output channels to them. If you are happy with the software-controlled timing offered by this VI, I will contact one of my colleagues to further debug the triggering issue.

Best Regards!

1127_edited.vi

Link to comment
Share on other sites

Thank you very much.
I was able to understand myself and explain to others.

I have a question about Labview. I'd like to graph the data as Excel at the end. At that time, I would like to make a line once for each sheet.
For example, if you go 5 times, you can have 5 rows per sheet.

Thank you.

Link to comment
Share on other sites

Hi kenken,

For logging the data in a spreadsheet, please right-click in a LabVIEW block diagram, select "Search" and look for "Write Delimited Spreadsheet". Double click on the search result, and then drag the icon that is highlighted into your block diagram. It should look like in the picture below.

image.png.770173a94f8055e4fe55339fef77a081.png

You then need to connect the data you want to put in a line to the "1D data" input, set the "append to file?" to T and also make sure you connect a constant or control with the file path and name to the "file path" input. This icon will create a CSV (Comma-Separated Values) file, which you can then open and edit in Excel or other similar programs.

Best Regards!

Link to comment
Share on other sites

Hi kenken,

In the VI you sent, you use two different methods to write to a measurements file: the "Write Delimited Spreadsheet" subVI I mentioned before and an Express VI for writing spreadsheets. You don't need both - any one of them would be enough. Therefore, I removed the Express VI and kept the "Write Delimited Spreadsheet".

Also:

- You did not wire a file path control or constant to the "file path" input, so I added a control for that;

- The waveform data you wanted to wire to the "1D data" input has a red dot next to the connection to the "Write Delimited Spreadsheet". This means some conversion must be done to the data, and this might mean it would not be written correctly to the spreadsheet. In our case, only one value gets written per run. The correct way to fix this is to index the array and take only the first waveform from it.

- Then, from the waveform you obtain, you only want the actual data samples, so you unbundle the data array (1-D) from the waveform; you then connect the result to the "Write Delimited Spreadsheet" 1D data input.

- The delimiter needs to be changed to a comma, so each written value corresponds to one CSV cell.

- If you want to save the waveform values with more digits after the decimal point, you can change the format from the default %.3f to, for example, %.7f.

I made the above changes, and uploaded the edited VI and a generated CSV file.

Best Regards!

datafile.csv 1206_edited.vi

Link to comment
Share on other sites

Hello.
Thank you very much for answering many questions sincerely. Thanks to you, good experimental results were obtained.

When I conducted an experiment based on the program I received the other day, some questions arose, so I will ask you a question.

In my experiment, I connected the oscilloscope made in Labview in parallel so that it could be displayed on the oscilloscope of the device.

Of these, the same waveform did not appear several times. Can you tell us something about that?

I think it's a timing issue or an issue with the use of Analog Discovery2.

Thank you.

Link to comment
Share on other sites

Hi @kenken,

I'm not certain what you mean when you say:

On 1/19/2020 at 11:57 PM, kenken said:

In my experiment, I connected the oscilloscope made in Labview in parallel so that it could be displayed on the oscilloscope of the device.

Of these, the same waveform did not appear several times.

Are you attempting to view the oscilloscope through both the WaveForms software and LabVIEW simultaneously?

I also don't understand what your statement of "the same waveform did not appear several times" means. How are you transferring the waveform? Where did the waveform not appear; on LabVIEW or the simultaneous oscilloscope or both? Did the waveform not appear initially or does it not appear intermittently?

Thanks,
JColvin

Link to comment
Share on other sites

Hello.
Thank you for your response.
I ’d like to ask you a question that arises from the test.

In my experiment, I want to display it on the oscilloscope with a delay of 20ms. You can delay it from an external device.

I wanted to display the waveform 20ms after measurement
The waveform of 20ms has been displayed from the end. What is the cause of this?

Also, the timing is not good
There are cases where the pulse wave is not displayed on the oscilloscope.
Thank you.718151853_(8).thumb.png.8fce1e4270994fc2add0777e96725773.png

Link to comment
Share on other sites

Hi kenken,

Please look at the attached LV_with_Waveforms_SDK.zip. It contains the following items:
- A version of the Digilent Waveforms library I imported into LabVIEW 2015 ("DwfLibrary" folder);
- A LabVIEW 2015 test project with contains this library, together with a test VI in which I started adding the functions indicated in the AnalogOut_Pulse.py source code;
- The AnalogOut_Pulse.py file;
- The WaveForms SDK Reference Manual.pdf manual.

To complete your project, you would need to continue to add functions to the Test VI, as indicated by the AnalogOut_Pulse.py source code. You can open the Python source code with any text editor. For extra information on the needed parameters, please follow the WaveForms SDK Reference Manual.pdf.

Best Regards!

LV_with_Waveforms_SDK.zip

Link to comment
Share on other sites

Thank you for your reply.
What I want to do is to create one 5V pulse and the duration is 1ms.

I want to control everything with labview without using python.
I ’ll try installing it, but if there ’s something else,
Thank you for your guidance and encouragement.

Link to comment
Share on other sites

Hi kenken,

If I understood correctly, you would like to generate a single 5V pulse? What length would that have? 1ms?

In any case, the digital outputs on the Analog Discovery 2 can only generate up to 3.3V output, so they would not work for your intended use case.

You can use instead one of the Waveform generator outputs to generate the pulse. However, the Digilent Waveforms VIs you are currently using do not provide the ability to reliably generate a single digital pulse. This functionality does exist in the Waveforms SDK, which is a library installed together with the Waveforms software.

I've attached to this answer a Python example showing how to generate a pulse (AnalogOut_Pulse.py) using Waveforms SDK.

If you would like to use LabVIEW instead of Python, you could import the Waveforms SDK library (called dwf.dll and found in the Windows\system32 folder) into LabVIEW (here is how: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Ls1SAE&l=en-US) and re-implement the attached Python script in LabVIEW.

Please let me know if you have any other questions.

Best Regards!

AnalogOut_Pulse.py

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...