• 0
kenken

analog discovery2 labview

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

Share this post


Link to post
Share on other sites

23 answers to this question

Recommended Posts

  • 0

Hi kenken,

Could you send me the LabVIEW VI you are using (which you have shown in the screenshots)?

Thank you!

Share this post


Link to post
Share on other sites
  • 0

Thank you for your reply.
My labview is 2015.
The VI version is 2019.

VI Package Manager 2019 is.

Is this all right?
Thank you.

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

Share this post


Link to post
Share on other sites
  • 0

I will explain the current situation in addition.
The ultimate goal is to apply a 5V voltage from the waveform generator.
Our instrument receives it and stimulates the cells.
Eventually, I'm trying to display the stimulus from that cell on the oscilloscope I'm making now.
Explain that it is decided as a detailed setting.
acquisition time: 500ms
Sample Rate: 20Ksps
Amplitude: 5V
Frequency: 50Hz

I'm sorry it's hard to understand.
However, I want to somehow complete this device.
Below is a screenshot.
Thank you.

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

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

Share this post


Link to post
Share on other sites
  • 0

Hi kenken,

Would it be possible for you to attach the actual file you are showing in the screenshots (function[...].vi) to this thread?

Thank you.

Edited by Ionut

Share this post


Link to post
Share on other sites
  • 0

I will explain the current situation in addition.
The ultimate goal is to apply a 5V voltage from the waveform generator.
Our instrument receives it and stimulates the cells.
Eventually, I'm trying to display the stimulus from that cell on the oscilloscope I'm making now.
Explain that it is decided as a detailed setting.
acquisition time: 500ms
Sample Rate: 20Ksps
Amplitude: 5V
Frequency: 50Hz

I'm sorry it's hard to understand.
However, I want to somehow complete this device.
Below is a screenshot.
Thank you.

function オシロ (2) 変更 - コピー.vi

Share this post


Link to post
Share on other sites
  • 0

Hi kenken,

Thank you for sending the VI!

I managed to run your VI and ended up at the following conclusions:

1. In your oscilloscope settings, you were setting the vertical range to only 1V, too small to see the entire signal you were generating. Once I set it to a value larger than the peak-to-peak level of your signal (at 5V amplitude, peak-to-peak would be 10V, so I set the vertical range to 20V), the correct signal level appeared.

2. The default buffer size for the oscilloscope input channels which is provided by Analog Discovery 2 is 8192 samples/channel (please see https://reference.digilentinc.com/reference/instrumentation/analog-discovery-2/reference-manual?redirect=1#refnotes:1:note15 for details). At your set sampling rate of 20kSamples/s, this means only 409.6ms, which you obtained. Once I lowered the sampling rate to 10kSamples/s, I managed to see the 500ms you wanted.

3. However, I could not reproduce the spikes on the waveform which you showed in your capture above. Every time I ran the VI, the waveform looks rectangular. Please make sure you connect both terminals of oscilloscope channel 1: the "+" needs to connect to Waveform Generator 1 terminal, while the "-" needs to connect to GND.

I've attached the updated VI here, together with some comments next to where I made the updates.

Please let me know if you encounter any other issues.

Best Regards!

function2.vi

Share this post


Link to post
Share on other sites
  • 0

Thank you for your response.
The explanation is very easy to understand and I am grateful.

The next question is, I am making a program that generates a digital signal once. How should I do it?
Is the icon a digital I / O?

Thank you.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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.

Share this post


Link to post
Share on other sites
  • 0

After all, python did not open properly and I could not see the program you sent me.
Also, putting Waveforms SDK in labview is not good enough and I'm confused.
Can you help me as I have to finish this program this week?
Thank you.

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

Thank you for your reply.
For the time being, I decided to output a 3.3V pulse wave for 1ms. What does that program look like?
I would be happy if you could show me a reference program.
Thank you.

Edited by kenken

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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!

Share this post


Link to post
Share on other sites
  • 0

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.

 

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites
  • 0

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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now