LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add dynamic data type as one of the terminals of a Custom VI

Hello,
 
Can anybody tell me if it's possible and how to add a dynamic data type as one of the terminals of a sub-VI? I would like to have a terminal that I can connect signal from DAQmx to my sub-VI.  Thanks.
 
 
0 Kudos
Message 1 of 9
(3,895 Views)
I never worked with the DDT, so I don't know exactly how it represents data, but here is a suggestion. Place any express VI using DDT on the diagram, right click it and select Open Front Panel followed by Convert. Then, copy the DDT control and paste it in your VI and see if that works. If it doesn't and the DDT has more than one representation, try finding another VI which has the one matching the one you need.

___________________
Try to take over the world!
Message 2 of 9
(3,888 Views)

On the signal manipulation pallette there is a function called to DDT use this and set it to the type of data you want. then all you have to do is right click on the input of the, ToDDT vi and create a control this will be your input.

Hope this helps




Joe.
"NOTHING IS EVER EASY"
Message 3 of 9
(3,883 Views)
Joe, Thank you very much for your pointer.  It works!!
 
 
0 Kudos
Message 4 of 9
(3,869 Views)

Joe, I must confess my ignorance about this. I thought "Spiderman" wanted a DDT terminal (the dark blue one), but your method gives a standard control. Why is that good for him? I assume it's because the DDT knows to automatically convert (as I've seen).

In that case, what's the point of the DDT? What is it good for? The manual says that it holds some additional data, but it also says that it is used mainly with express VIs, which I believe are not used by most serious programmers. So what's the point of the DDT (not that I really care, since I don't do anything in this area)? Is it worth anything?


___________________
Try to take over the world!
0 Kudos
Message 5 of 9
(3,862 Views)

Hi tst,

Actually what I wanted to do is for my subVI to be able to "accept" a signal coming out from a DAQmx.  Before Joe's pointer, I wasn't able to add an appropriate terminal that will accept DAQmx signal which is DDT because I was limited to only numeric or boolean input only (whith my limited LabVIEW knowledge).

0 Kudos
Message 6 of 9
(3,855 Views)

I am really surprised that this worked for you, It was just a shot that hit I guess. I do not understand really why you even need the to dynamic data terminal anyway. I am very curious. what function in Daqmx are you using. Are you using the Daq assistant. Post a snap shot of your code.

Hey tst how can we find out what type of information is added to dynamic data. It is probably timing info, name, sampling info. Not sure though.

Anyone know what the true benefit is if it is a benefit at all.




Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 9
(3,848 Views)
Now you guys got me thinking.  I attached a snapshot of what I'm trying to do.  Basically a DAQmx signal to my subVI.  I'm new to LabVIEW and still need time to get used to with the dataflow concept.  In VB/VB.NET programming, data type management is very strict. That's why I'm trying to match the DAQmx signal data type with the input data type of my subVI (just my instinct).  Is this not necessary?
 
 
0 Kudos
Message 8 of 9
(3,838 Views)

Here is one of the coolest things about LV, and one of its major advantages over languages like VB - it has automatic memory management and it compiles whenever you make a change. This allows you to be very free in the way you handle data and change your code. In this case, you should note the small gray dot that appears when you wire the dynamic data into the Array of Waveforms input. This gray dot means that LV coerces the source data type (DDT, in this case) to the target data type (Array of waveforms). If it wouldn't match, you would get a broken wire, the VI couldn't run, and if you hover over the wire or press the broken run button you would get an exact description of the error. Cool, eh?

This can also be seen in other things. For example, you can change an array's data type or number of dimensions by simply doing it. This will automatically be reflected anywhere the array is called in the program, and if anything won't match, the VI will be broken. If you change the # of dimensions of an array, any array function which that array is wired to will adapt. This allows you to be very safe in the way you write code, because you have LV watching all that annoying stuff for you. You don't have to worry about misspelling a variable here (for the most part).

One important point about coercion - it does take processor power. This will usually only be evident in large arrays or loops, but it is an important point. Another thing is that coercing numeric types can cause you to lose data - coercing a DBL to a U16, for example, will cause you to lose all the fractional data.

To learn more about LabVIEW, I suggest you try searching this site and google for LabVIEW tutorials. Here and here are a couple you can start with. You can also contact your local NI office and join one of their courses.
In addition, I suggest you read the LabVIEW style guide and the LabVIEW user manual (Help>>Search the LabVIEW Bookshelf).


___________________
Try to take over the world!
Message 9 of 9
(3,824 Views)