LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

adding a time shift to the waveform in LABVIEW

Solved!
Go to solution

Dear Sir, 

              I have created a LabVIEW VI where I want to generate a sine and cosine wave form to create a circular waveform. In VI, I want to add a time shift to cosine wave, where it will start from 0 to maximum with a time laps of 0.25 sec with respect to sine waveform. The VI found to be working in simulation. But I am not able to get any waveform from the NI USB 6251 DAQ board while connecting it to the Digital Oscilloscope. Please help to solve this problem. I have attached the VI herewith. 

Thank You 

Download All
0 Kudos
Message 1 of 8
(2,187 Views)

 

Hi prasad,

 


@prasad145 wrote:

But I am not able to get any waveform from the NI USB 6251 DAQ board while connecting it to the Digital Oscilloscope.


Some things:

You create two waveforms, then you build an array for each waveform, then you JoinSignals those arrays. Why do you do so? Why not use just one BuildArray function to create an array from your two waveforms?

The AO DAQmx task is defined with just one output channel, but yet you want to output an array of waveforms: this is a clear mismatch…

There should be a wait function in the while loop…

 


@prasad145 wrote:
In VI, I want to add a time shift to cosine wave, where it will start from 0 to maximum with a time laps of 0.25 sec with respect to sine waveform.

A time shift of a (co)sine wave can be translated into a phase shift. You can set the phase shift at the GenerateSineWave function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 8
(2,135 Views)

Dear Sir, 

              Thank You for the reply, I want to make cosine function start from 0 to max, that is why I didn't used phase shift in the sine wave generator. Instead want to shift the time in the second sinusoidal waveform by 0.25 sec, so that I will get a cosine function starting at 0.5sec. I am unable to append a constant 0 V signal for 0.25sec with second sinusoidal wave form.  In the DAQmx signal generator, I have selected the Physical Signals as ao0:1, so that both the analog output channels ao0 and ao1 will generate signals simultaneously. Please suggest any modification I can make in the VI to generate one channel with sinusoidal wave from 0 to max and another channel with cosine in the form of sine from 0 to max but with a time shift of 0.25 sec. 

 

Thank You 

0 Kudos
Message 3 of 8
(2,129 Views)

I have modified the code by adding a append waveform, and removed all unnecessary arrays. But still not getting waveform from the DAQ hardware. 

0 Kudos
Message 4 of 8
(2,111 Views)
Solution
Accepted by topic author prasad145

Hi, @prasad145,

I have modified the code by adding a append waveform, and removed all unnecessary arrays. But still not getting waveform from the DAQ hardware. 


If I understand your issue, you're trying to create this waveform:

Spoiler
Beginning of waveform removed_JoB.PNG

Remove start of waveform_JoB.png

 Is that what you're trying to do?

Or is your issue only in trying to output to the DAQ hardware?

 

-joeorbob

Message 5 of 8
(2,074 Views)

No, I want the sinusoidal wave to start after 0.25 sec with amplitude ranging from 0 to 3, means start at 0 at 0.25 sec and reach 3 at 0.75 sec. And another waveform to start at 0 at 0sec and reach 3 at 0.5sec. 

 

Actually now i solved the issue in my previous VI. where there are sample mismatch in the waveform coming from sine and cosine generator . Now after this modification the DAQ is able to generate required waveform 

Thank You very much for your support. 

0 Kudos
Message 6 of 8
(2,044 Views)
Solution
Accepted by topic author prasad145

Hi prasad,

 


@prasad145 wrote:

I want the sinusoidal wave to start after 0.25 sec with amplitude ranging from 0 to 3, means start at 0 at 0.25 sec and reach 3 at 0.75 sec. And another waveform to start at 0 at 0sec and reach 3 at 0.5sec. 


Then you need to create such a waveform from two parts:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 8
(2,027 Views)

Thank You for the support. I got the result after sample match. 

             

0 Kudos
Message 8 of 8
(2,001 Views)