06-30-2011 04:18 AM
Hello,
I have a rather specific problem - from the beginning:
The concept is to create a dll from a LabVIEW VI and call a function from the dll using Python. The pictures illustrates my first approach. The VI takes Fahrenheit as input and converts it to Celsius which is output, very simple.
Now, I wish to do this in Python by calling the dll created from the VI with this specifics:
The python script uses ctypes to import the dll and to fetch its function(s). It looks like this:
Thus, all is well and moving forward to a slightly more complicated VI. The next VI sets a specified voltage to a specified channel, accordingly:
The properties of the dll is specified as:
Again a similar function call is made in Python with the following script. This time it won't work, is it because of the LStrHandle *PhysicalChannel parameter?
It seems like the Physical Channel parameter must be given as a LabVIEW string type, but how to do it in Python? Preferably I would like to do it directly in Python but a C++ wrap will work as well if necessary.
Cheers,
K. Berg
PS. Thank you for this excellent board which has answered a battery of questions already .DS
06-30-2011 08:57 AM
I solved it by replacing the tedious LabVIEW stringtype in the VI with a simple string input - a very simple solution to a simple problem. Just hope that someone has use of this answer and question.
Have a good one,
K.Berg
06-30-2011 09:16 AM - edited 06-30-2011 09:19 AM
Very useful for me. Thanks for SPAMming the forum with Python code!
EDIT: BTW, I found most of the NI DAQmx functions ported into a Python module on the web recently. Search it out if you haven't already.
07-01-2011 02:55 AM
@NIquist wrote:
Very useful for me. Thanks for SPAMming the forum with Python code!
EDIT: BTW, I found most of the NI DAQmx functions ported into a Python module on the web recently. Search it out if you haven't already.
Woha!
Thanks a lot, this is dynamite: http://packages.python.org/PyDAQmx/usage.html
You've got to love the internet
/Karl