09-04-2014 08:56 AM
Okay I've been tasked with interfacing a new oven over ethernet that runs a control application written in LabView.
I've been given and successfully run another LabView project that allows me to hook into the oven and control it remotely, but this is obviously an executable, and essentially I'd like to create a dll so that I can include it in a LabWindows project.
The requirements at this stage are very simple. The UI of the remote control project has a variable temperature setting dialog item that is constantly monitored inside a do-while loop and the value then transmitted across ethernet to update the oven every 500ms. Additionally there are stop and start buttons to turn the oven on and off, both of which are monitored and state changes transmitted.
Ideally I'd like to be able take the executable, strip out the bits of the UI I dont actually need, then make a shared dll or better still, a .NET interop assembly.
I've already tried the later approach firstly checking out the concept, and creating a simple project that takes in two values, multiplies them and returns the value. That worked just fine.
I then tried to create a dll from the project, adding the dialog items I was interested in interacting with, to the terminal window so they are exposed outside of the resulting dll.
Although this built okay, and I was able to get to a point in software where I passed in the temperature value, at that point it hung - not in a nasty way as such, more like it was waiting to return from the labview dll but didnt find a way back.
This is the first time I've had to use LabView in anger before so it's a little alien to be coming from a conventional coding background. Any thoughts as to what I might be doing wrong.... I can post screen shots of the VI if required.
Solved! Go to Solution.
09-04-2014 09:11 AM
09-04-2014 09:31 AM
Okay here are the screen shots...
What I want to happen is that in the same way once the exe version of this starting polling data as soon as it is run, the dll version does the same.... Then when I call the functionality and pass in the two values these are are then transmitted continuously whilst it then returns back to the program that called it.
The other thought I had was whether instead of having the do while loops inside the LabView dll, whether I can send commands into the dll to request the appropriate ethernet activity.
09-04-2014 09:40 AM
09-04-2014 09:48 AM
Sorry for the confusion... The VI i mentioned initially was a simple test utility to prove that I could iimport the resulting .NET object into LabWindows, and that worked just fine.
As you say the picture I posted are of the project I want to get operational. I'm thinking what I'll need to do is load the values I need into some form of global storage, then fire a request to run the Ethernet part of the process in order to action everything.
I dont actually need most of the UI as it will be implemented elsewhere with values returned from this routine - eventually!
09-04-2014 10:06 AM
09-04-2014 10:07 AM
No thats very true!
09-04-2014 10:53 AM
09-04-2014 11:09 AM
Yes I agree.... Once I get my head round LabView a little more I'll probably look at reworking whats here.... Its a little inconvenient having to pass all the parameters in one shot to a single VI. But for the time being I'll work with what I've got. Although I came from an electronics background originally which should make understanding how LabView elements are constructed more straightforward, relating them to the equivalent 'real code' I'm not finding so easy. I'm sure it will come with time however.
Having stripped out all the do while loops I do appear to have something that is working in some form. Tomorrow I'll have to set aside some time to see if its actually doing what I think it is doing.
Thanks for your help... if the tests prove successful I shut down the query.
09-05-2014 09:05 AM
Right I'm making some progress... indeed I have the functionality working.... but its incredibly slow, and I'm pretty sure I know why.
Still a single VI at this point which opens , writes some register info and closes the ehternet connection each time I want to do something.
What I've noticed is that after opening the port there seems to be a finite amount of time before the first of the commands will actually work - in this case around 15 seconds. I've actually noticed this behaviour with the original code I was supplied with, but after this time period has elapsed and because the port isnt then closed until the application shuts, the problem then goes away.
Ideally what I'd like to be able to do is the following in my dll
1)Open the port before use
2) Throw at regular intervals commands at the open port
3) Close the port after use
Its easy enough to visualise how you'd structure this in a C++ or C# class, but I can't visualise how you'd do this with one or more VI's. Any thoughts.