Running LabVIEW as a Windows Service

Today I finally got around to using Visual Studio to create a Windows Service that will call a LabVIEW executable every 10 minutes to log temperature to a database.

We have been running a LabVIEW application as a service using a free version of FireDemon but found today that our corporate anti virus software marks the executable as a Trojan. Getting an exception for this will take ages so after referring to google I found an article on MSDN with the title Windows Services: New Base Classes in .NET Make Writing a Windows Service Easy.

In under an hour I had created a service, installed and tested it as described in the above article.

Our application requires an up-to-date temperature to be available to a number of machines. To measure the temperature we are using a USB data acquisition device connected to a thermocouple which is polled by one PC periodically and then updates a database. We have the LabVIEW code to take the measurements and log the temperature as we were using FireDemon to run this as a service.

We have Measurement Studio which allows us to use our data acquisition devices under Visual Studio but as we have LabVIEW code already in place to do the data acquisition and updating the database I will use this for now. Rewriting in Visual Studio is a job for another day.

After a few modifications to the example code in the MSDN article I managed to get our LabVIEW code executing every 10 minutes.

Since implementing this NI have produced a network attached DAQ device which we are currently looking at for future projects.

Published by

swinders

Work as Systems Analyst for a company in Portsmouth, United Kingdom. Program mostly using LabVIEW and use MS SQL for database. Trying to get to grips with Visual Studio when I get chance.

Leave a Reply