08-16-2009 11:09 PM - edited 08-16-2009 11:10 PM
Using pulse width modulated signal (square wave) to control when a signal is turned on or off
Greetings All
I'm trying to use a labview created pulse width modulated signal (square wave) to control when a signal is turned on or off.
Here's my logic and graphic example:
1) The source wave signal is continuous
2) Use a PWM (square wave) created in labview to control when the signal is turned on or off
3) If PWM signal (amplitude) is greater than 0 play signal if PWM is not greater than 0 don't play signal.
I'm actually using this to step sequence / pulse several separate magnetic coils using my audio card (which has several audio output channels), I have a signal in labview played constantly. Than compare it to the PWM (square wave) which controls if the signal gets played on each separate channel or not. That way I can control which coil is on and off and in what sequence they are activated.
I couldn't find an edge detection for a square wave created in labview so I tried Limits but that doesn't seem to work unless I change the phase manually and that only goes from 1 to -1. I'm just trying to compare the PWM (square wave edges) already created by labview / play a signal if the pulse is greater than 0 and it turns off the signal if it's less than 0.
Should I be doing this another way
Tia
Solved! Go to Solution.
08-17-2009 08:00 AM
08-18-2009 08:26 PM
Hi Sal,
Based on your AC-PWM2.gif, it looks like all you need to do is pull out the y component of your waveform and check if the magnitude is > 0. Then use a case structure to choose whether or not you output the current value of the source signal.
08-19-2009 03:03 PM - edited 08-19-2009 03:05 PM
Greetings,
I tried it two ways using amplitude and levels and fft spectrum. The values don't seem to update the way I need them to (basiclly showing a 0 or a 1). I compare the Y values like you recommended but they don't ever seem to update.
tia
08-20-2009 01:30 PM
I was still thinking bringing it back to only outputting the signal when your square wave is high, similar to the community example below. Just think of the Boolean = true to be when your square wave is high.
08-20-2009 04:42 PM - edited 08-20-2009 04:43 PM
Thanks for the example but the reason I was doing it this way was due to the fact that I have 8 signals to control so the basic True/False wouldn't work. My logic was to have one square wave generator controlling all 8 signals by changing the duty cycle / phase shift of each one separately.
I was trying to use a square wave to create a software based adjustable pulse train that turned on and off 8 other signals.
1) Basically taking the controlling square wave signal apart for each 8 source signals
2) adjusting the phase / duty cycle of each one (will be able to create my own "sudo pulse train")
2) building the waveform again
2) Do an Analog to digital conversion of controlling square wave
3) Digital to Boolean of each controlling square wave
4) Square wave is now turned into Boolean will Control if loop is turned on or off
It looks like the main problem is converting the square wave to Boolean
thanks for all the help
08-21-2009 05:26 PM
Maybe I am misunderstanding you, but it sounds like you are taking a single square wave, converting it to 8 separate square waves with which you turn on your output signals. Why not start with 8 separate square waves with which you can control their individual duty cycles?
To convert a square wave to Boolean, all you should need to do is compare its value to a threshold like 0.5. The compare VI will output true if the value is > 0.5, and false if the value is < 0.5.
08-23-2009 02:49 PM
Yes I'm trying to use just one square wave signal to control them all. From your reply the image below should work but it doesn't due to the fact that one is a boolean array and the other is just boolean.
08-24-2009 10:44 AM
A waveform contains an array of values. You must check each value and react to it accordingly: