LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing an array in output using Ulx

Hello everyone,

I'm using LabView 2017 and I need help making a very simple program in Labview. I'm using an external clock signal to syncronize the generation of an output signal. I'm using MC USB-1808X and a square wave generator as the external clock; with the Ulx library, I was already able to syncronize a Delta-Ramp in output with this type of clock, but I eventually need to use an array.

The problem is that what is passed in output is only the last element of the array; I don't understand what is wrong since a pre-build function as Delta-Ramp is sending out an array as expected, but in this case it doesn't work. I started using LabView two weeks ago, maybe the solution is obvious but I really can't see it.

Please take a look at my VI, this problem is really holding up my research.

0 Kudos
Message 1 of 5
(3,100 Views)

Well, with two weeks of LabVIEW, you are not ready to start using it in your "research".  You need to learn LabVIEW.  Here are some comments:

  • Thank you for posting your code.  You seem to be using a lot of "unknown functions" from ULx -- their names resemble the names of DAQmx functions, but as I don't have this library, I can't tell what they do.
  • You seem to be trying to generate a 400-point Triangle wave, and replicating it 200 times, resulting in an array of 80,000 points.
  • You feed this into what seems to be an Analog Out function.  What are the parameters of this function?  How many points did you tell it to output?  How many points did it output?
  • I assume you realize that the Analog Out function will run exactly once, right?
  • Can I assume that you have not "played" with your DAQ device using NI MAX (and an oscilloscope to observe the outputs)?  Before trying to program your device, run some Test Panels using MAX and understand how it works.

Bob Schor

0 Kudos
Message 2 of 5
(3,072 Views)

The device outputs correctly when I use a waveform instead of the array I'm passing, I have ,obviously, already tested it with an oscilloscope using a signal generator which is setted as external clock (connected to the correct pins of the device). I have already used this program with DAQmx commands and another DAQ (which was from NI), it worked as I expected; with the USB-1808x, the functions from Ulx which substitutes DAQmx are not working. The analog write only writes the last element of the array; it should write a new value in synch with the external clock as it was done with, for example, the Ramp by Delta. It happen a strange event this morning: LabView failed and quitted, and the output signal was sent correctly to the oscilloscope, doing up and down ramps as written in the code. 

I am working on a master's thesis, despite being new to LabView I have a deadline for this part of the project which is for the end of this month; meaning that I can't really start to learn labview from the basics.

 

 

0 Kudos
Message 3 of 5
(3,066 Views)

Hi Fede,

 

The device outputs correctly when I use a waveform instead of the array I'm passing,

Simple solution: convert your array into a waveform!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 5
(3,063 Views)

I solved this problem in a different way today, by putting the Ulx function "Start" into a while loop. I don't know if there is a more efficient way, but with a 1 kHz external clock the output signal is correct: each step of the ramp has 1ms lenght as expected. I post the code here in case anyone encounters the same problem, but for sure it is possible to do a better VI for this task. Thanks for the help!

0 Kudos
Message 5 of 5
(3,049 Views)