tags:

views:

1199

answers:

5

I have written a standalone app that controls a device through rs-232 port and some customers want to be able to use the device with Labview. I have seen some threads describing where to start when learning to use labview, but I was wondering if anyone has experience with writing a plugin/driver (is that the right word?) for Labview and perhaps point me in the right direction.

The existing app is GUI that allows people to control the device with higher level concepts - rather than have to know the syntax and protocol of the serial port comms stuff. I want to abstract that away as well so that users can just plug something into labview and I suppose it exposes some verbs and methods that allow the device to be manipulated and also provide data to clients.

I think there is a serial port interface from labview, but I am sure the people using this device do not want to have to write the code (parsers and etc) to communicate with the device.

+2  A: 

There are two options for what you're trying to do.

  • Create a DLL that users of your device can call from LabVIEW.

  • Rewrite your application in LabVIEW.

To reach the largest possible number of potential customers, option #1 would be the best solution for you. If your customers are specifically asking for a LabVIEW driver then option #2 would probably be the least hassle for that specific customer. The reason for this is that LabVIEW is very much a niche language (for automation and data acquisition), and for many LabVIEW developers it's the only language they know (or the only one they know well).

Bill the Lizard
A: 

This would be an addition to our product line - we currently have a stand-alone app (that requires no programming) that allows customers to control the device. We want to add possibility for those using LabVIEW (let's say those who want some kind of PID or other interaction with this device and other telemetry) to control the device from LabVIEW.

There is no need for us to re-write our generaic app in LabVIEW.

I'll look into the DLL/VI possibility but I was hoping for more information - perhaps some resources that would be useful for this.

EDIT

I just installed the 30 day trial and ran LabVIEW.

All I can say is WTF.

This thing is a monster. It sucks CPU and has an enormous memory footprint.
I am also dumbfounded about how to use it. This must be one of the least intuitive pieces of software I have ever witnessed. NI apparently realizes this and they have all sorts of documentation and tutorials and etc., but this only serves to confuse even more. There is a sea of help and documentation but they do me no good because I am overwhelmed with where to start. I understand now why this device does not have a driver already...

Tim
"This must be one of the least intuitive pieces of software I have ever witnessed." As compared to C++, which is obvious and intuitive out of the box?
eaolson
c++ is a programming language. There is a simple, straightforward specification. NI is just about at the top of the list of confusing pieces of software. Granted it is probably very flexible and powerful, but wow is it non-intuitive.
Tim
LabVIEW is a programming language too, not just a "piece of software". I do remember how overwhelmed I was at first though. I suggest you start at the beginning (there are tutorials and example code in the Help menu). :)
Bill the Lizard
Not to sound wierd, but maybe LabVIEW is too easy for you??? Seriously. My mother (who uses a WinTel PC with Vista) went to use my aunts iMac and got totally confused about how to copy pictures around. I reminded my mom, "Mom its just really easy, just do what your intuition tells you to do...", and she tried dragging files into iPhoto, and it just worked. LabVIEW is a graphical programming environment, and is easier for most people (esp. undergrad/grad students in science), but harder for programmers who know how to control a computer with words.
sheepsimulator
+1  A: 

The best resource for LabVIEW programmers is National Instruments Knowledge Base. Since LabVIEW is only popular in such a small segment, there aren't a lot of other web resources out there.

One book that I read back when I programmed in LabVIEW was LabVIEW Power Programming. It has a lot of good example code, and if I remember correctly, it shows you how to use 3rd party DLLs written in C++. What it definitely doesn't show you is how to write those DLLs, though.

Bill the Lizard
Yeah - that is the trouble I have found. I will try looking for more info on that site.
Tim
+2  A: 

Labview can handle RS232 communication with little problems - you just need to provide the customer with a list of the commands and syntax that the device uses, and perhaps a small framework or example VI with basic functionality.

I applaud you for wanting to provide a more robust driver that doesn't require the user to parse their own commands; what is usually called a Labview 'driver' by most vendors is little more than a few commands ('init','read') bundled up in a simple GUI.

You don't have to rebuild your complete application, just give them enough to get started on their own =)

To get started, you will probably want to use VISA in LabVIEW.

thanks - I understand about LV having rs232 support, and like you said, I want to make using the device very simple. (I am not the device mnfgr - just a developer filling a (tiny) need)
Tim
+4  A: 

If you are prepared to invest a bit of time into learning how to program in LabVIEW, the relevant info on how to develop an instrument driver can be found here and here .

Essentially you should provide a set of VI's (the unit of LabVIEW code) that implement the various operations supported by your device. LabVIEW programmers will chain a sequence of these together using the VISA resource (i.e. serial port) and error in/out terminals which your VI's should provide. See the second link for an example.

If you don't want to learn how to do this properly - which your second post suggests you don't - then either create a DLL that exposes the necessary functions, or commission a LabVIEW programmer to write the driver for you. If you can supply adequate documentation of your protocol and it's not hideously complicated then it should take them an afternoon. If you have users who are keen on LabVIEW then one of them might be happy to do the job for you for an appropriate discount or incentive - it's really not hard for anyone competent in LabVIEW to do and they are the ones who already have their hands on your device and understand what it does. You might want to beta test the result with your other LabVIEW users first, as you won't be in a position to assess the quality of what they do yourself.

If you go the DLL route you'll need to check that the parameters you require are compatible with LabVIEW data types. I'm not a C/C++ programmer so I can't tell you in detail what this means but this might be helpful (Rolf Kalbermatter is the guru on interfacing LabVIEW with external code).

If you want to find a LabVIEW programmer then National Instruments can refer you to one through their alliance scheme.

(Edited to add link to LAVA forum post on writing DLLs for LabVIEW)

nekomatic
Thanks. I will definitely do it the right way when we have time to get to it. I just assumed it would be fairly straightforward to get this working.
Tim