LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview

How can i inter-convert a sine to square wave and vice versa in the labview ?

0 Kudos
Message 1 of 7
(1,458 Views)

Hi kar,

 


@kar2000 wrote:

How can i inter-convert a sine to square wave and vice versa in the labview ?


Before starting to implement some code in LabVIEW you should write down some simplified algorithm on a sheet of paper!

Can you provide math formulas for both conversions?

 

From sine to square it's quite easy: sign(x)...

Best regards,
GerdW


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

@kar2000 wrote:

How can i inter-convert a sine to square wave and vice versa in the labview ?


You would do it exactly the same as in any other programming language. Do you have problems with the theory or with the implementation?

 

Is this a real measurement or just some noiseless simulation? Is the frequency fixed or variable? How do you want to convert the amplitude (Max? RMS?)? Maybe all you need is measure the primary frequency and simulate one or the other. What's the purpose of all this?

0 Kudos
Message 3 of 7
(1,406 Views)

like i generated the sine wave swiftly as i attached , but what now i want is to convert the sine wave to a square wave.

 

i tried Schmidt trigger method but not that fruitful; what else should i implement. 

0 Kudos
Message 4 of 7
(1,309 Views)

Hi kar,

 

unfortunately you attached your VI with LabVIEW2021, which not everybody is using yet. Please attach a downconverted version of this VI so more people are able to open it! (Edit->Save for previous)

 


@kar2000 wrote:

what now i want is to convert the sine wave to a square wave.


Did you try that sign() function?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(1,294 Views)

Why not just use the built in waveform generating functions?

 

Fgen.png

FgenCapture.PNG

Cfg2apture.PNG

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 6 of 7
(1,272 Views)

If you want to convert a sine wave to a square wave, and vice versa (assuming you know nothing about either waveform except that it is a sinusoid or a square wave), you will need to analyze the signal (which, in turn, means you need a large enough sample to include a full cycle) and, from this analysis, deduce the properties of the "other" signal, then generate that other signal.

 

On the other hand, if you already know that you want to, at the flip of a switch, generate a sinusoid or a square wave with a common set of parameters (such as "frequency" or "periodicity", "amplitude" or "peak-to-peak", "mean", and possibly "phase" or "delay"), then this is easy, as LabVIEW provides "generators" for you that will do exactly that (look on the Block Diagram Palettes, the Palette called "Signal Processing", sub-Palette "Wfm Generation" (or Waveform Generation)).

 

Bob Schor

0 Kudos
Message 7 of 7
(1,244 Views)