LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

square wave periodic stimulus?

I have pulled my hair out tyring to figure out what I am doing wrong (even after innumerable hours of research) and I cannot seem to figure this out. I am trying to make the amplitude increase by (for example) 5mV after each stimulus. For example,

 

 

stimuli=3

change in amp= 5mV

initial amp=10mV 

 

Then the first stimulus will be 10mV, the second 15mV, thrid 20mV. I have everything working (period, duration ... etc) except this periodic increase in amplitude. 

 

I have tried to implement this in a for loop, a while loop, and even separating the components and concatenating them again, yet all to no avail. I attached the subvi below. if you can point out my error or lead me in the right direction that would be much appreciated. 

0 Kudos
Message 1 of 6
(3,473 Views)

Hi 1986,

 

as I cannot open your VI due to it's LabVIEW version I suggest this:

check.png

Simple and easy…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(3,406 Views)

Do this in LabVIEW -- it is much easier than trying to mix LabVIEW and Matlab for something this simple.  Take the Beginning LabVIEW tutorials, learn about loops, shift registers, timing functions, etc.  When you have done this, it should be very easy to write some code to do what you propose.

 

When thinking about problems such as this, you need to think "what varies" and "what stays the same".  You also need to think (when considering loops) whether you want to "loop until some condition, such as a button push, occurs" or "Do this twice" or "Do this 1000 times".  The first type of loop is a While loop, the second is a For loop.  Both are explained in the tutorial material.  Also pay attention to Shift Registers (which serve as "loop memory") and how to use them.

 

Bob Schor

0 Kudos
Message 3 of 6
(3,402 Views)

How do you plan to trigger the amp change? Is this time based, will there be some signal? What should cause the change in Amp?

 

It also looks like you are doing this in RT environment. Is this correct because it will change what you can do for options?

Tim
GHSP
0 Kudos
Message 4 of 6
(3,396 Views)

If I'm understanding correctly what you need here, wouldn't just adding a constant multiplied by the number of stimuli, to the amplitude value result in the changes you would want here. I that something similar to what I'm attaching should do what you need.

0 Kudos
Message 5 of 6
(3,381 Views)

The easiest way would be to use an event structure assuming your arcitecture allows for that. Here is an example of what I would do for this.

 

Example.png

Tim
GHSP
0 Kudos
Message 6 of 6
(3,370 Views)