From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Running LV VI / program from python

Hi,

 

I have an automation SW written in python and I would like to get my LV measuring capabilities in to that

meaning calling the LV program and get the measured results back to my PY scripts

 

in LV i use the DAQMX to measure

 

if someone can help me with a small start programmer that would be helpful

 

using NI 6289 DAQ MX to measure differential voltage

 

thanks

Assaf

 

 

 

 

0 Kudos
Message 1 of 3
(2,878 Views)

@abaker wrote:

Hi,

 

I have an automation SW written in python and I would like to get my LV measuring capabilities in to that

meaning calling the LV program and get the measured results back to my PY scripts

 

in LV i use the DAQMX to measure

 

if someone can help me with a small start programmer that would be helpful

 

using NI 6289 DAQ MX to measure differential voltage

 

thanks

Assaf

 

 

 

 


Use sockets for example, then you can also communicate with your LV program across a TCP/IP/UDP network.

 

Python Sockets:

http://www.evolt.org/node/60276

 

LabVIEW sockets:

http://www.ni.com/white-paper/2710/en

 

Br,

 

/Roger

 

0 Kudos
Message 2 of 3
(2,877 Views)

You could build your LabVIEW VI into a DLL and easily call that from Python using ctypes.

 

Attached is a very simple project with two VIs - AddNumbers.vi and SubtractNumbers.vi. You need to create a build specification for a DLL that includes these.

 

  • Right Click Build Specifications and select New/Shared Library (DLL)
  • Change the Target filename to LabVIEWMath.dll (or you have to edit the Python file that I included)
  • Change the Destination directory to the directory that contains the attached example project (not good practice but convenient here)
  • Select Source Files
  • Move AddNumbers.vi to the Exported VIs by highlighting them and clicking the blue arrow
  • Keep the defaults on Define VI Prototype (make sure you have C Calling Conventions selected)
  • Repeat the previous two steps for SubtractNumbers.vi
  • Click Build

Now from a command prompt, change to the LabVIEW example project directory and run the attached script 'Call LabVIEW.py'

 

 

=====================
LabVIEW 2012


0 Kudos
Message 3 of 3
(2,857 Views)