05-28-2022 12:40 AM
How can i inter-convert a sine to square wave and vice versa in the labview ?
05-28-2022 02:52 AM
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)...
05-28-2022 09:56 AM
@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?
06-01-2022 01:38 AM
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.
06-01-2022 03:25 AM
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?
06-01-2022 12:22 PM - edited 06-01-2022 12:24 PM
Why not just use the built in waveform generating functions?
06-01-2022 01:50 PM
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