Jump to content

Anything to whatever (LV 7.1)


Aitor Solar

Recommended Posts

Hi, people.

I would be very grateful if you test this simple program and give me some feedback. Surely the technique is not revolutionary, but I find it useful as a proof of concept.

Basically, same.vi gets an input and returns it in the output. So it does nothing, but it adapts to anything you connect to the input.

post-1450-1159531697.jpg?width=400

Some instructions to make sure it works (let's hope!):

1) Re-compile all the VIs in the llb. If you get asked for Get Contorl From Type Descriptor.vi, it is usually located in your <LabVIEW directory>/project/_NewProbeWizard.llb.

2) Run relink.vi.

3) Now, drop same.vi in another block diagram and test different inputs.

Caveats:

a) I've checked it also works with customized controls, but it loses the type definition link. I'll work on that.

b) To make it work in LV8+. you'll need the Get Contorl From Type Descriptor.vi from LV7.1, since the modern version has no type descriptor input. Strange.

Saludos,

Aitor

Download File:post-1450-1159532049.llb

Link to comment
Well, I guess it hasn't worked for anybody :( . Maybe in the future I'll come to an easier way of doing the same.

Saludos,

Aitor

Hi Aitor,

I was very excited when I saw your initial post becuase I have wanted to do things like that many times.

Unfortunatley my laptop disk crashed :headbang: and I have not managed to get any of my LV versions installed (silly nilm.exe is cloning itself and gobbling up all of my CPU, I digress :oops: ).

So speaking for myself, your posting looks very interesting and I am planning to learn something from it as soon as I can.

Ben

Link to comment
So speaking for myself, your posting looks very interesting and I am planning to learn something from it as soon as I can.

Oh, well, then I hope your computer get repaired fast :)

I have now the LV8.x version, it wasn't that difficult. As previously, compile the whole llb and run relink.vi before using same.vi in a block diagram.

LV8 version:

Saludos,

Aitor

Download File:post-1450-1159886824.llb

Link to comment
I download it, then I noticed some VIs (that I believe you made) were password protected. My interest pretty much dropped at that point.

Oh, I had to make them protected since I tested them in a shared computer. Password is "expreso". I'll put a non-protected version if you like.

Saludos,

Entro

Link to comment
:laugh:

Hmmm - maybe it's been there too long for you to be able to edit it? That's okay - just post the new version.

There'll have to be tomorrow, I don't have LV here.

If after all this fuss you don't tell me is a great idea, I won't post more code ever :laugh:.

...

No, wait, it's not a joke :nono:.

Saludos,

Aitor

Link to comment

:blink:

Well, I don't know what you were expecting, nor I have promised anything other than a VI who adapts to the input type at develop time.

Recently this issue was discussed and it was said a polymorphic VI would be the answer, but making a poly subVI for every possible input type is unaffordable. So you need a VI that, somehow, runs some code when a terminal is connected. That would be, of course, a XNode, but Xnodes are difficult to implement, specially in LV8+, and usually you don't need all the capabilities they offer, but just a way to change some code in that subVI.

So I've come to what I thought it was a simpler way. It is, of course, an Express VI, where the configuration VI is used to change what you need of the original VI (by scripting) without a dialog. Is not a perfect solution, since it doesn't update automatically when you connect something (you have to double-click it), but I've found it surprisingly easy. LV passes the config VI all the references you need, from the subVI an its parent VI, to change them the way you like (be it really simple, like this example, or as complex as you could make it). And every instance works indepently, so you can use them in different VIs, or several times in the same VI, without fear.

Not that I have presented it as a solution to anything, just a "Hey, I think this is nice, look if it works for you". No doubt a lot of people can make it better. But it's never late to learn, and for sure I have learned a lot from this thread for future participations.

Saludos,

Aitor

Link to comment
  • 3 weeks later...

Hey fellas, check this out --- I added it to the code repository a while ago:

XNode Wrapper

Not only does the output conform to whatever datatype you wire to the type input, but the code actually DOES SOMETHING! The XNode will script a call to the VI with a similar name and type cast the output to the datatype specified.

Email me with questions if you're confused. I'm still trying to refine the documentation.

An example of how I use this:

I have a program that requires some custom handshaking between server and client using Datasocket communcations. I input the URL and the datatype of the datasocket item I'm requesting. Then, the output conforms to the type I want so I don't have to use the 'Variant to Data' function every time I want to call it. This is handy-- its the same thing the DataSocket Read function, and many other LabVIEW functions do anyway, but now I can do the same thing with any of my own VI's.

I'm eager to see the day when NI will release XNodes to us the way they have with XControls. But until then... this'll have to do.

Link to comment

Hmmm, I can see maybe using the original express version at the start of the thread as a temporary way to make a wire label. Change the VI icon to be a short black wire with "label" instead of "same" and then use the caption as the wire label. Unfortunately we wtill have the problem that if we move the wire the VI stays in the same place until manually moved.

Sigh, when are we getting real wire labels.

Oopps .. almost forgot, Great Job ! to both Aitor and nrao !

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.