NI Home > Community > NI Discussion Forums
Reply
Member Ams
Member
Ams
Posts: 25
0 Kudos

How can I generate a staircase waveform in Labview

Hello,

How can a staircase waveform be created in Labview. I have attached the waveform needed.

Ams

 

Trusted Enthusiast
devchander
Posts: 2,276

Re: How can I generate a staircase waveform in Labview

Hi Ams,

The attached vi will generate one cycle of a staircase waveform

Hope this helps,

Regards,

Dev

Knight of NI
altenbach
Posts: 26,082
0 Kudos

Re: How can I generate a staircase waveform in Labview

[ Edited ]
A waveform typically has a constant time increment between points. Your xls example has two y values for each even timepoint so to reproduce your example directly would be a bit tricky. Attached is one possible very simple solution that has a constant dt.
 
Modify as needed. :smileyhappy:
 

Message Edited by altenbach on 12-17-2006 10:36 PM


LabVIEW Champion . Do more with less code and in less time .

Member Ams
Member
Ams
Posts: 25
0 Kudos

Re: How can I generate a staircase waveform in Labview

hello,

both the earlier queries are regarding the staircase ; i somwhat understood the VI you sent me but the reshape part is not clear ; i am not sure why it is there, i think you are using it to plot but should it not be just a 2 D array. Is it true that the graph is only plotted when the entire array is filled up i.e the loops have been completely executed.

Ams

Knight of NI
altenbach
Posts: 26,082
0 Kudos

Re: How can I generate a staircase waveform in Labview

[ Edited ]
The inner loop creates one cycle of the waveform. The outer loop duplicates it by the desired number of cycles, creating a 2D array while doing so. The reshaping simply converts it back to a 2D array, appending all cycles.
 
Yes, the entire waveform is generated once, then displayed. Once you have one cycle of the waveform, you can easily output it point-by-point, one cycle at a time, etc. as needed.
 
In your other message you hinted that you need offset and multipliers for scaling of the signal. Here's a simple example. The details of the implementation depend on your exact needs.

Message Edited by altenbach on 12-18-2006 11:47 PM


LabVIEW Champion . Do more with less code and in less time .

Member Ams
Member
Ams
Posts: 25
0 Kudos

staircase trigger

Hello altenbach,

The staircase waveform works great . Thanks a lot for that . However I have run into another difficulty. I am trying to use it as a trigger and I have a way of using the staircase as a trigger by sending it's output to the trigger input and then using a counter however for certain reasons I need to get a square pulse trigger from the same staircase program  maybe by putting a second DAQ output (I already put one to get the waveform out).

So essentially I am trying to get a signal out whenever the 1st step is executed in a cycle by using an If condition to check the iteration in the for loop . The problem is that I get an error message since there is an array comparision going on and I need a boolean o/p for trigger.

 

 

Knight of NI
altenbach
Posts: 26,082
0 Kudos

Re: staircase trigger

Well, that won't work.

First of all, LabVIEW starts counting with zero, so use the premade "=0?" node. :smileywink: Easiest would be to generate a signal with the same number of points, it is just mostly zero.

You probably want to do the comparison inside the loop, then feed it to a switch where you select between the ON and OFF trigger voltage. Autoindex out the array and treat it like the existing one.


LabVIEW Champion . Do more with less code and in less time .

Member Ams
Member
Ams
Posts: 25
0 Kudos

Re: How can I generate a staircase waveform in Labview

Altenbach,

I need a modification on the staircase waveform you sent me (I have attached it). The next staircase starts as soon as the previous one finishes. However I need a waiting period where the next waveform waits for a used defined time before starting the next staircase ; alternatively the 1st step of the next staircase is a much longer one (user defined)

A couple of ideas

1) Add a wait time function (within the outer loop)  which is user defined so that the next staicase waits until that time elapses (Done if step =1 for a particular cycle)  .

2) Add another new time step control and a check inside the loop (if step =1 for a particular cycle then use a different new step time control else use the default step time)

So we still have the staircase but with an elongated 1st step .

Please help me implement this in labview.

Ams

Proven Zealot
johnsold
Posts: 9,247
0 Kudos

Re: How can I generate a staircase waveform in Labview

Ams,

Here is a modified version of your staircase generator. I removed the DAQ stuff so I could run it. The modification consists of appending an array of zeros or Offset to the staircase cycle. The number of elements to be appended is the Intercycle Interval divided by the timestep.

Lynn
Member Ams
Member
Ams
Posts: 25
0 Kudos

Re: How can I generate a staircase waveform in Labview

Lynn,

The code you sent me does not give me a staircase waveform. I have attached the O/P I saw on my end (below that is the staircase I currently get). What I want is a staircase with a time gap between the end of one cycle and the start of a new one. What should I feed into the intercycle interval if I want a 0.2 sec separation.

 

 

Aman