LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Square Wave Digital Output

I have a real simple LabVIEW program I need to write, but I have never worked with digital outputs:

I would like to the take two Square Waveform Generators, where I can adjust the frequency and duty cycle, then feed these waves into some simple logic ('and' and 'or') and then from these simple boolean logic gates, produce a digital output of the signals.

Thanks
0 Kudos
Message 1 of 12
(8,949 Views)
What kind of hardware do you have for this?

Mark
0 Kudos
Message 2 of 12
(8,949 Views)
LabVIEW v6.1 -- with a DAQ -- 16 analog in, 2 analog out, and 8 digital (I don't remember how many digital channels).

I can generate the wave, create the logic, and the output channels, but the problem it taking a waveform into a 'or' or 'and' gate since it only wants a signal that is 1's or 0's and a square wave could have a much higher amplitude than one.

Thanks,
Travis
0 Kudos
Message 3 of 12
(8,949 Views)
I'm a bit confused by what you are trying to do, but I'll offer my opinion.

Since you are trying to do gate manipulation on these signals, I'd create (generate) the wave with "on" being 1, and "off" being 0 volts. Create your logic. Then, before you send it out on your DACs (I'm assuming that's how you are going to send out these signals), multiply and add an offset to your wave array to get the amplitude/offset that you want, which obviously can be something other than 1 and 0 volts for off and on.

Am I missing something?

Mark
0 Kudos
Message 4 of 12
(8,949 Views)
What I need to do is:
Create two square waves that have variable frequency and duty cycle. Take these two wave forms: I want the 'and' output of these two waveforms, and I want the 'or' output of these two waveforms. Then I want the 'and', 'or' outputs as a digital signal.

Problem is: I am creating my variable waveform with no trouble, but both the 'and' and 'or' gates will not accept the waveform input.

Thanks,
Travis
0 Kudos
Message 5 of 12
(8,949 Views)
Helle, sir:

The reason logic gates won't work on the Square Wave vi's is that the output of them is(are) an ARRAY of samples that LOOKS like a square wave..but really isnt. There are two approaches, depending on how fast you need this to operate. You can either, as you suggested, use a comparitor function to generate a T or an F from your wave amplitude, and then use the BOOLEAN functions to do your AND...this is really slow......or you can use the card itself to generate the waveform...much preferred, if you have the right hardware. Alternatively, you can GENERATE a logical square wave using a case structure inside a loop....wire a T and an F inside one of each of the cases, and then take put a Wait until inside the LOOP....this will set your frequency(s)


Let me know how you fare!

ERic
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 6 of 12
(8,725 Views)
Ah, is that all? That's no problem....

Under the Waveform palette, select the Get Waveform Components VI. Right click on the t0, and go to select item -> Y. Wire your waveform array into it, and out of this will come your values. This is what you want to AND or OR.

The waveform type contains 3 items of information--t0, which is the starting time; dt, which is the delta time between data points; and Y, which is the data points.

Using the Waveform -> Build Waveform, after you've ORed or ANDed your Y's, you can rebuild the waveform type again if you wish.

Hopefully that's what you needed.

Mark
0 Kudos
Message 7 of 12
(8,949 Views)
I believe you want to look at some of the "COUNTER" examples in the help files. The counters use the DAQ card for all your timing functions, and do include combinational logic outputs. Look especially at the "LOGICAL FILTERS" subvi's for examples.

Good luck!

Eric
Eric P. Nichols
P.O. Box 56235
North Pole, AK 99705
0 Kudos
Message 8 of 12
(8,949 Views)
Mark,

This is what I have done (attached). If I wanted to have the first frequency set to about 10kHz, and the second frequency set to about 20Hz -- would this work (in theory). The ANDed and ORed outputs will be used to turn ON and OFF two colors of LED's at very high rates.
0 Kudos
Message 9 of 12
(8,949 Views)
You're correct right up until you try to physically output this on your DAQ card.

By looking at the specs you gave me for the card, it looks like you have an E-series card. Most E-series cards don't have buffered digital output. Which DAQ card do you have?

Mark
0 Kudos
Message 10 of 12
(8,949 Views)