03-02-2016 07:25 AM
Hi All
Im trying to create a VI that converts a sine wave to square wave with unsymetrical switching points. So far ive created a VI that does it symmetrically but cannot for the life of me figure out how to do it asymetrically.
I want a HI when the sine wave is greater than +0.41 and switch low when the sine wave gets below -0.14
Can anyone help.
Ive attached my current VI to this message.
Thansk
03-02-2016 07:54 AM
03-02-2016 07:55 AM
Use a shift register to maintain which value should be output of the loop. When the value goes above 0,41, change that value to 1. When it is less than -.14 change it to zero. When it is in between, output whatever value of 0 or 1 is still in the shift register from the previous iteration
03-02-2016 07:55 AM
How do i do this can you explain
03-02-2016 07:56 AM
can you show me how to do this.
Thanks
03-02-2016 08:02 AM
@JWinstanley wrote:How do i do this can you explain
Yes. But it is better if you try for yourself. It is a a shift register and a couple select statements.
I'll give you the start and you can figure out how to put in the 2nd part.
03-02-2016 08:50 AM
A ranged case structure could work as well. Not quite as flexible, but can be simpler to understand.
03-02-2016 02:57 PM
OK, your question can be summarized as follows:
The key concept here is the third step, having the next output be the same as the previous output if the input is somewhere in the middle. Do you know about While Loops in their "Do Once" mode with Shift Registers (sometimes called a "Memory")? If you configure one such thing, you can put two Case Statements inside it to handle the "forced Hi" and "forced Lo" conditions, with the "otherwise" being the former output living on the Shift Register.
If none of this makes any sense to you, spend some time with the LabVIEW Tutorials (look in the upper right corner of the LabVIEW Forum Home Page).
Bob Schor