LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

black box application

Why can't you simply make the front panel of the subVI visible and click on the controls directly? You insist on making things complicated. If you want a main's front panel control to be accessed in the subVI, you pass the reference of that control to the sub VI.

What I expect from new users is that they actually take the free tutorials instead of posting numerous questions that they should know.
0 Kudos
Message 11 of 32
(1,418 Views)

I am not trying to give control to the subvi, I am trying to give control to the main vi.

 

Basically I want my subvi to act just like creating a call library function. I want the user to interact with it and build their vi with it.

0 Kudos
Message 12 of 32
(1,400 Views)
I understand what you said but you haven't paid any attention to what I said about passing a control's reference INTO the subVI instead of a subVI passing something out like you said.

0 Kudos
Message 13 of 32
(1,385 Views)

I understand what you are saying. The problem is I will have no control over what is in the main vi. If you mean make it so an input into my subvi takes a control that will have a reference in the subvi then I think we are saying the same thing in different ways

0 Kudos
Message 14 of 32
(1,376 Views)
Another simple solution is to remove the loop in the subVI and have a loop in the main that calls the subVI.
0 Kudos
Message 15 of 32
(1,374 Views)

My application needs to do certain things to interact with my hardware. What I am trying to do is take the c code and basically create what is happening with my block diagram. A user would then be able to treat it like a function call by setting variables and looking at outputs. It would get a lot more complicated than this, but I hope you get the idea.

 

What you are suggesting would lead to multiple subvis inside a subvi.

0 Kudos
Message 16 of 32
(1,357 Views)

What is wrong with multiple subVI's in a subVI?

 

Your code sounds like it is completely flipped inside out.  The fact you are trying to recreate something that was written in C into LabVIEW is the first clue something is wrong.

 

If you want a black box function, that is what a subVI does.  It has inputs, it does calculations, and it returns the results as an output when it ends.

0 Kudos
Message 17 of 32
(1,344 Views)

If you're creating a LabVIEW wrapper/driver for a C-driver/DLL for an instrument or something, that's something that is worth doing but I have seen many examples where bad LabVIEW programmers have been asked to write LabVIEW wrappers for drivers and their implementations have been terrible and in some cases they have been locked so we ended up rewriting it from scratch.

 

Take a leaf out of the instrument driver book and wrap the individual functions that the instrument offers into LabVIEW VIs that someone can use in their VIs. Make sure they are well documented.

 

DAQmx is actually a pretty good example of what a LabVIEW driver should look like:

2016-02-19_10-16-45.png


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 18 of 32
(1,325 Views)

When I am trying to download DAQxm, it does not say that windows 10 is supported.

 

So you believe that creating an instrument driver is what I should be doing? I was just thrown off by the templates because it looked like it was creating a low level interaction between labview and the device. I do not need to implement how bits will be sent through a usb cable. Maybe you are able to guide me. The concept of what I am trying to do seems like it should be an instrument driver. I was looking at the labview help for creating a custom driver and I would basically need to get rid of all the VIs already in the driver.

0 Kudos
Message 19 of 32
(1,287 Views)
I just used DAQmx as an example of how if you're writing a LabVIEW API (programming interface) for a piece of hardware, that is how I would expect it to be done. You could also look at things like the VISA / TCP/IP palette - it essentially follows the idea of creating VIs to configure, start/stop and then to read/write to the device (e.g. send a command / receive data)

There are quite a lot of hardware vendors that just produce a DLL for their hardware so you can interface with it from many languages, but then they create a LabVIEW wrapper so you can use it in LabVIEW without needing to create all the wrapper VIs yourself.

You don't necessarily have to create an IDnet instrument driver (which mostly applies to serial instruments you communicate with via NI VISA) but there is lots of good information about how to structure the VIs, documentation etc. which would probably apply in your case. There is a tutorial here: http://www.ni.com/tutorial/3271/en/

LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 20 of 32
(1,277 Views)