LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Square Wave for DAQ output

Solved!
Go to solution

Hello, I am trying to build a custom square wave to input into a DT9834 Data Translation DAC device. I am aware that a square wave vi exists within LabView, but I am trying to achieve the same thing by building an array and inputting that into the write VI. Currently, what I have theoretically creates a square wave, but when output from the device it does not create a true square wave presumably due to the time it takes for the DAC to switch.

I would like to be able to input the pulse width and amplitude of one edge of the signal and have it loop to repeat this square wave until there is for example 100,000 samples in an array, which is then passed to the write command. If I try to loop Insert Into Array, it will just write over itself within the loop.

For example if I had a pulse width of 100, and a amplitude of 5:
It would write 100 5s into an array, then 100 -5s, giving 200 samples total, and then continue on until it reaches the indicated amount of samples (lets say for this case its 1000 samples), so at index 200 it would insert another 100 5s, at index 300 its inserting another 100 -5s. And so on.

If anyone could help it would be greatly appreciated, I am attaching the VI as the file and also as a screenshot that I am currently working with, thank you.

tareyes_0-1702321950642.png

 

0 Kudos
Message 1 of 4
(536 Views)
Solution
Accepted by topic author tareyes

Hi tareyes,

 

why do you use InsertIntoArray in your image when you want to build an array? BuildArray seems to fit much better…

 


@tareyes wrote:

For example if I had a pulse width of 100, and a amplitude of 5:
It would write 100 5s into an array, then 100 -5s, giving 200 samples total, and then continue on until it reaches the indicated amount of samples (lets say for this case its 1000 samples), so at index 200 it would insert another 100 5s, at index 300 its inserting another 100 -5s. And so on.


Use a loop to repeat your pulses.

Use a concatenating output tunnel to build your array of samples…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 4
(518 Views)

Your device has, in addition to Analog output (D/A), Digital output (D0) and Counter/Timers (implemented with "digital" hardware).  Digital circuitry "switches" much faster, typically, than Analog (probably because they only have to work with two voltage levels, typically 0 and +5 V, while Analog circuits work with 12-16 (or more) "bits" of data, much slower.  If you need "variable voltage", (and you haven't made clear if this is a real requirement), an amplifier (with or without variable gain) can change the 0 to 5 V range to whatever range you require, again (for a fixed gain) without any serious time penalty.  You can (potentially) even use a (fixed) D/A channel as the "fixed Gain" setting for such an amplifier.

 

Bob Schor

Message 3 of 4
(485 Views)

Hi GerdW, 

Thank you for your insight on concatenating output tunnels. I ended up making the program work using this method putting Insert into array into a for loop, controlling the N for the for loop as (n = samples/width) can provide a control for samples. 

Hi Bob_Schor,

 

Thank you for your help, I need a variable input from 1-3V for different testing scenarios, apologies for not clarifying. 

0 Kudos
Message 4 of 4
(462 Views)