To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This example shows one way to convert an input signal into a square wave of arbitrary amplitude.
Description
This example shows one way to convert an input signal into a square wave of arbitrary amplitude. The VI takes an input signal, filters it to get the desired frequency components, then amplifies the signal greatly so that it can then be clipped into a square wave. The example assumes that the measured signal does not have a DC offset or that the DC offset is removed during filtering. An offset can be applied to the signal after filtering but before scaling to change the duty cycle of the resulting square wave if desired. The program assumes that the input signal is an array of doubles.
Requirements
LabVIEW Full System Development 2012 or compatible, LabVIEW Advanced Signal Processing Toolkit
Steps to Implement or Execute Code
Additional Information or References
VI Front Panel
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange. **
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Doesn't look like the attachment is showing up...
Thanks Todd.Fixed it!
Why not pass the original signal array through the 'Sign' function to get a unit amplitude square wave then scale it to the amplitude you need? Much less code required.