#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0

    Passing data from a file to DLL


    I need to use Python to open a file which has a set of data (1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0) and pass those data into LABVIEW in DLL.

    I try to use command below to open a file and read data from file but I have no idea how to pass argument into LABVIEW.DLL. I managed to do it with constant values in degC_array.

    fp = open('C:\\ExamplePytoLV\\Invensys Python calling LabVIEW\\TestDocument1.txt')
    fp.read()

    This is my code as below,

    from ctypes import CDLL, c_double,c_int32
    print ("Starting")
    N = 12
    TenDegC = (c_double * N)
    TenF = (c_double * N)
    degC_array = TenDegC(1.0,2.0,3.0,4.0,5.0,6.0,7.0,8.0,9.0,10.0,11.0,12.0)
    F_array = TenF(0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0)
    error = c_int32
    for i in degC_array: print (i)
    print
    #Load DLL in to memory
    CtoFDLL = CDLL ("C:\\ExamplePytoLV\\Invensys Python calling LabVIEW\\CtoF.dll")
    CtoFDLL.CtoF(degC_array,c_int32(N),F_array,c_int32(N))
    for i in F_array: print (i),
    print


    Many Thanks.
    Walter.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,854
    Rep Power
    481
    Did you succeed? "...I have no idea how to pass argument into LABVIEW.DLL. I managed to do it..."

    I don't have labview, but may later find labview manuals. What error or problem did you observe?
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    2
    Rep Power
    0
    Originally Posted by b49P23TIvg
    Did you succeed? "...I have no idea how to pass argument into LABVIEW.DLL. I managed to do it..."

    I don't have labview, but may later find labview manuals. What error or problem did you observe?
    Sorry for not explain clearly. Yes, I managed to integrate LABVIEW DLL. But, I have no idea how to write output data from LABVIEW DLL into a text document using Pyhton.

    Please help.

    Walter.

IMN logo majestic logo threadwatch logo seochat tools logo