12-11-2023 01:12 PM
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.
Solved! Go to Solution.
12-11-2023 01:54 PM
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…
12-11-2023 09:18 PM
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
12-12-2023 11:16 AM
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.