Configure string parameter for LabView dll

Hi,
I have created a simple LV 2010 vi (Starting vi) that reads the identification of an oscilloscope. I then take this vi and build it to a LabView dll. I test the dll by calling it from LabView (RunFrom dll). It essentially seems to work but len and ReadBuffer come back blank. It has to be in the way I am configuring the parameter setup for Readbuffer (Parameter Setup) in the dll configuration. I have tried several different configurations but nothing seems to work. Any help is appreciated!
Jim Haas
Solved!
Go to Solution.
Attachments:
Starting vi.png ‏43 KB
RunFrom dll.png ‏29 KB
Parameter Setup.png ‏20 KB

What's the len parameter for?  Normally you would set that as the length of the string, but it appears you haven't done that.  Also, you're passing len by value, not by reference, so the function expects it to be an input and you'll never get back a value other than whatever value you provide.
Don't use a local variable of ReadBuffer for the "readbuffer" input.  You need to pass an initialized string long enough to hold the expected amount of data.  The easiest way to do this is to use Initialize Array to create an array of U8, then use byte array to string.  Set the "minimum size" parameter to "len" and pass in the length of the initialized string (this isn't required but is good practice).  If you need the resulting length output, add another indicator and parameter for that value.  There might be a way to do it with a single parameter by passing len by reference, you'd have to experiment (it's definitely doable in C but I don't know if LabVIEW allows it).

Similar Messages

  • Change a string parameter for different session

    Hi Gurus,
    I would like to find out how can I change a string parameter for an existing different session?
    In DBMS_SYSTEM package there are two functions :
    - SET_INT_PARAM_IN_SESSION
    - SET_BOOL_PARAM_IN_SESSION
    which change values of parameters, but not string ones :(
    Is it possible and if not, is there an alternative for changing STATISTICS_LEVEL for different session to ALL?
    Thank you in advance,
    Ela

    Hi,
    >>Once again: how to change a string parameter for a DIFFERENT session?
    Once again I will repeat if I was not clear before: You cannot to do this. Just directly using ALTER SESSION against the session.
    * SET_INT_PARAM_IN_SESSION: Sets[u] integer-type init.ora parameters in any session
    * SET_BOOL_PARAM_IN_SESSION: Sets boolean-type init.ora parameters in any session
    Cheers
    Legatti

  • How to pass Visa Resoure Name parameter to labview dll in labwindows​​/cvi

    Hi, everyone
    I build a dll from labview, the prototype is : double  getchannelpower(double f, uintptr_t *VISAResourceName);
    I don't know how to pass VISAResourceName to this function.How can I get the VISAResourceName of this type(uintptr_t *)?
    Is it related to the paremeter ViPSession in function viOpen(ViSession sesn,ViRsrc rn,ViAccessMode am,ViUInt32 ti,ViPSession vi)?
    BRs,
    lotusky

    1. uintptr_t *VISAResourceName in the labview dll is connected to viOpen function as input parameter internally.
    2.I can call the labview dll in labview via CLF Node, when the VISAResourceName parameter is set  to Numeric(32-bit int or 32-bit usigned int) OR Adapt to data(Handle by Value). And I got the value of the VISAResourceName parameter, which is 0; When I directly connect 0 to the dll, it still works. But in labwindows, when  I pass 0 to the VISAResourceName parameter of the dll function, I got a FATAL RUN-TIME ERROR: The program has caused a 'General Protection' fault.
    mkossmann 已写:
    Could you check what exactly uintptr_t *VISAResourceName in your labview dll does.Might it be that it is connected to the labviews Dll internal ViOpen() ViSession output parameter ?.   And the name VISAResourceName is misleading.
    Another idea would be that Labview uses 32bit Unicode for the ResourceName. And you have to convert the C String to that Unicode first.

  • Specifying parameters for labview dll

    hi.
    Im using the help files in labview 8.2 which are the only good directions Ive found to build a dll with labview.
    I was able to go through the example without a problem.
    This includes adding the needed parameters that are passed via the function (see figure below)
    The problem is that, when i get to the part for the parameters i need to specify for my file, there are none listed (see figure below)
    I can even copy the entire code out of the example file (meanmedianmode.vi) and paste it in my vi and the newly compied parameters dont show up why i try to export as a dll
    Little help here, i dont see any documentation regarding this..
    the two files i am using as source files, one is just example code and one is my file
    example file has plenty of paramesters, they seem to just be indicators, nothing fancy.
    my file has no parameters listed, i even copied the entire code of the example file into it trying to get some to show up.
    Message Edited by jimmyinCT on 03-05-2008 05:11 PM
    Message Edited by jimmyinCT on 03-05-2008 05:12 PM

    here is the vi
    http://www.engr.uconn.edu/~jmacione/dll3.vi
    and project
    http://www.engr.uconn.edu/~jmacione/labviewdll.lvproj
    For this particular project, ive incorported my signal generator vis into the example file for meanmodemedian.vi (example file for building dlls)
    Ive rewired the "mode" indicator into the area of code for the signal simulator, and replaced it with  "mode3" , a copy
    In the project, Im only getting "mode" as an output parmeter along with the other two from the example file, "median" and "mean".
    It appears i cant create any new output parameters and am stuck with the three from the example file.
    Yes, this files were  recomplied with control shift run ahead of time.
    I had resaved it to ahead of time.
    I must be tired or getting old or something,  but ive been stuck on this for a few weeks.
    I do remember making dlls in labview 3years ago, dont remember it being this hard
    If it matters, this is 8.2 on vista
    Message Edited by jimmyinCT on 03-06-2008 07:09 PM
    Message Edited by jimmyinCT on 03-06-2008 07:09 PM
    Message Edited by jimmyinCT on 03-06-2008 07:11 PM
    Message Edited by jimmyinCT on 03-06-2008 07:11 PM

  • Configuring profile parameter for a table lock object

    Hi Experts-
      I want to set the 'wait time' (_WAIT) parameter as a profile parameter for a table lock object.
      I have created a lock object on a ZTable. I lock and unlock this object in exclusive non-cumulative mode through the enqueue and dequeue lock object function modules. These generated FMs are invoked via my custom function module.
      My function module will run in the background as a scheduled task in R/3. I execute the Enqueue FM at the start of the FM and keep the table locked until the last step finishes in my FM and then I Dequeue it. I want to have the processing wait and retry the Enqueuring FM at set intervals in case the one run doesn't finish entirely and a new run of this same job kicks off.
    Thank you,
    - Vik.

    Set the wait parameter = 'X'.  These means that if it encounters a lock, then it will wait a certain time for the lock to be released.  This certain time is a system value set by your basis team.  I don't imagine it being a very long time.
      CALL FUNCTION 'ENQUEUE_EZPIPHYINVREF'
           EXPORTING
                MODE_ZPIPHYINVREF = 'E'
                MANDT             = SY-MANDT
                _WAIT             = 'X'.
    Regards,
    Rich Heilman

  • Configuration string keys in LabVIEW 2009 changes

    I am trying to write a configuration file to be used by other (non-labview) software.
    However the LabVIEW 2009 'write sting key' function adds quotes around string keys, even if the 'raw string' mode is used, this makes this tool USELESS, and I could only finde a little note in the online help
    When VIs write to a configuration file, they place
    quotation marks around any string or path data. LabVIEW also supports
    single quotes around values in .ini
    files.
    I could not find it in the Upgrade notes.
    Could we get an option to remove the quotes?
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

    Dear Ton,
    thank you so much for your post. This problem was brought to the attention from our R&D department, hopefully they will add this soon to the writekey.vi . There is a work arroud for now; you can add the attached VI to the library;
    Download the attached VI and place in the following path: <Program Files>\National Instruments\LabVIEW\vi.lib\Utility\config.llb
    In the same folder, double-click NI_LVConfig.lvlib
    Right-click the Write folder and add the above-mentioned VI.
    Hopefully this will bring you further,
    Best regards,
    Martijn S
    Applications Engineer
    NI Netherlands
    Attachments:
    WriteKey(String)workaround[1].vi ‏14 KB

  • Apex 4 ldap configuration string syntax for multiple ou

    I created a working string cn=%LDAP_USER%, ou=employee, o=Toronto.
    I have another organization unit called non-employee.
    I have checked the Oracle Forums and google for syntax that would be compatible to authentication schemes in shared components of APEX.
    "(&(uid=%LDAP_USER%)(|(ou:dn:=employee)(ou:dn:=non-employee)))" and every variation that I could think of for an OR operation between ou. I even tried ou=* without success.
    What worked for one organization unit was uid=%LDAP_USER%, ou=employee, o=Toronto.
    uid=%LDAP_USER%, ((ou=employee) | (ou=non-employee)), o=Toronto and every variation there of did not work. I would like to union the two groups.
    Otherwise, it means copying the same application so that each would have a connection string. This is inefficient.
    I do not control the LDAP server so I cannot create an ou=everyone group.
    In summary, looking for a LDAP connection string syntax to union more than one ou.

    Hi, I've solved my problem. Seems that the pair of quotes around the DN is unnecessary and causing me the agony.
    Thanks!

  • Labview DLL

    Hey i have some trouble send and receiving strings from a dll build in
    labview. I use the CStr pointer has anyone an example written in Visual C++
    that access the Strings from a Labview dll
    Regards
    Esben

    i only see 3 ways to pass a string in the define prototype dialog.
    string handle pointer
    Cstring pointer
    Pascal string pointer
    Could any just tell me how to pass astring to a labview dll from MFC with
    just one of these methods
    regards Esben
    ----- Original Message -----
    From: Matt R
    Newsgroups: comp.lang.labview
    Sent: Friday, April 27, 2001 12:20 AM
    Subject: Re: Labview DLL
    > To call a LabVIEW DLL from C you should tell LabVIEW to pass the
    > string as a C string. Do not use LabVIEW strings, as there is no easy
    > way for the caller of the DLL to properly create a LabVIEW string to
    > be passed into the DLL.

  • Creating string pointer for dll

    I'm trying to use a DLL to access a Reflective memory board using LV6.i
    under Windows2000. The first call to the DLL takes a pointer to a string
    that contains the device name and it returns a handle to that has to be
    used in all other calls.
    The syntax is - RFMHANDLE rfmOpen( char devPath );
    The example in the documentation is;
    RFMHANDLE rh;
    char *devPath = "\\\\.\\RFM1"; This is the
    W2000 name for the board
    if( (rh = rfmOpen( devPath ) ) == NULL ){
    exit(1);
    All the other calls pass the handle rh as the calling parameter.
    My question is how do I create the string pointer devPath?
    Ed

    Ed,
    I'm a Labview DLL rookie but I think all you have to do is in the DLL
    configure define the arg Type as a "String" and the String Format as a "C
    String Pointer". Then when you wire that terminal up, just connect it to
    Sting Constant or Control. Then just pass that argument the device name
    string. Labview will take care of actually passing the that string pointer
    value to the DLL.
    I just done something similar with an array of 16 bytes. I am supposed to
    pass the function the pointer to the array and it will change the data in
    that array. I defined the arg as Type "Array" of Data Type "Unsigned 8-bit
    Integer", Dimension "1", and Array Format as an "Array Data Pointer". I
    then connected that terminal to the Build Array function of 16 bytes. The
    output terminal
    directly accross from that input terminal was connected to
    an array indicator. When I run the VI the data bytes were changed as
    expected.
    The point is that I never really had to deal with the pointer directly. So
    you don't have to create the string pointer, just create the string and
    connect it to the terminal defined as a string.
    - David
    Ed Bogart wrote:
    > I'm trying to use a DLL to access a Reflective memory board using LV6.i
    > under Windows2000. The first call to the DLL takes a pointer to a string
    > that contains the device name and it returns a handle to that has to be
    > used in all other calls.
    >
    > The syntax is - RFMHANDLE rfmOpen( char devPath );
    >
    > The example in the documentation is;
    > RFMHANDLE rh;
    > char *devPath = "\\\\.\\RFM1"; This is the
    > W2000 name for the board
    >
    > if( (rh = rfmOpen( devPath ) ) == NULL ){
    > ....
    > exit(1);
    > }
    >
    > All the other calls pass the handle rh as the calling paramete
    r.
    >
    > My question is how do I create the string pointer devPath?
    >
    > Ed

  • Calling LabVIEW DLL from C with 2d array strings

    I am trying to write a DLL in C that calls a LabVIEW DLL that has a
    number of functions that each return a 2D array of strings which are the formatted
    measurements, with column 1 being the measurement name and column 2
    being the measurement. I wanted to use the 2D array of strings since
    this would give a uniform interface for returning measurements. Ive
    cobbled together bits and pieces of messages and example code I've
    found here into something that almost works, and was hoping someone
    with a little more experience in interfacing C with LabVIEW DLLs would
    be able to help me.
    Here's a little
    snippet from the header file generated when building the LabVIEW DLL:
    typedef struct {
    long dimSizes[2];
    LStrHandle String[1];
    } TD1;
    typedef TD1 **TD1Hdl;
    long __cdecl TestVI(char serialNumber[],  TD1Hdl *formattedMeasurements, char ErrorDescription[], long len);
    The "TestVI" VI generates a 2D array of strings. The cell contents and number of rows are random to
    simulate different measurement names and measurements.
    Here's a snippet for the wrapper class:
    class CArgoTestsLabVIEW 
    public:
    CArgoTestsLabVIEW();
    virtual ~CArgoTestsLabVIEW();
    // test modules called from parent DLL
    BOOL GetResult_LV(CString resultName, double *result);
    long TestVI_LV(CString serialNumber);
    private:
    TD1Hdl m_LVStringArray;
    CMapStringToString m_resultMap;
    InitMeasurementsArray();
    PopulateResultMap();
    The "m_LVStringArray" is intended to hold the 2D array of strings that
    the test modules spit out. The "m_resultMap" is just for accessing the
    measurements from the parent DLL via the "GetResult_LV" function.
    The implementation of TestVI_LV is:
    long CArgoTestsLabVIEW::TestVI_LV(CString serialNumber)
    long rc = 0;
    char errStr[BUFFERLEN];
    strcpy(errStr,"");
    rc = InitMeasurementsArray();
    if (rc == 0) {
    rc = TestVI(serialNumber.GetBuffer(serialNumber.GetLength()), &m_LVStringArray, errStr, BUFFERLEN);
    PopulateResultMap();
    return rc;
    The accessor functions InitMeasurementsArray and PopulateResultMap are:
    long CArgoTestsLabVIEW::InitMeasurementsArray()
    MgErr err;
    if (m_LVStringArray)
    DSDisposeHandle(m_LVStringArray);
    m_LVStringArray = (TD1Hdl)DSNewHandle(sizeof(TD1));
    // code to check for NULL
    // Set number of strings in array to 0
    (*m_LVStringArray)->dimSizes[0] = 0;
    (*m_LVStringArray)->dimSizes[1] = 0;
    // Set total size of array structure. For now it is only as big as the long variable.
    err = DSSetHandleSize((UHandle)m_LVStringArray, sizeof(long));
    // code to check for error
    return 0;
    void CArgoTestsLabVIEW::PopulateResultMap()
    int numberOfResults;
    int i;
    int charCnt;
    numberOfResults = (*m_LVStringArray)->dimSizes[0];
    if (numberOfResults == 0) {
    return;
    m_resultMap.RemoveAll();
    for (i = 0; i < numberOfResults; i++) {
    charCnt = (*((*m_LVStringArray)->String[i * 2]))->cnt;
    (*((*m_LVStringArray)->String[i * 2]))->str[charCnt] = '\0';
    charCnt = (*((*m_LVStringArray)->String[i * 2 + 1]))->cnt;
    (*((*m_LVStringArray)->String[i * 2 + 1]))->str[charCnt] = '\0';
    m_resultMap.SetAt((LPCTSTR) (*((*m_LVStringArray)->String[i * 2]))->str, (LPCTSTR) (*((*m_LVStringArray)->String[i * 2 + 1]))->str);
    The problem I have is that I eventually get an access violation from
    the run-time engine if I try to call the test VI in a loop. I'm
    obviously having a memory management problem, but it escapes me as to
    where the problem is. Anybody have any ideas?

    smercurio_fc wrote:
    The problem I have is that I eventually get an access violation from the run-time engine if I try to call the test VI in a loop. I'm obviously having a memory management problem, but it escapes me as to where the problem is. Anybody have any ideas?
    (*((*m_LVStringArray)->String[i * 2]))->str[charCnt] = '\0';
    Hi smercurio,
          Have you solved this?  I don't work with C much anymore, but it looks, here, as if the memory at str[charCnt] isn't yours to address/change.
    Is index "charCnt" one char past the end of the String-memory allocated by LabVIEW? 
    just an idea!
    Hmmm, maybe page 9 is a bit far back to fish in the unanswered posts.
    Message Edited by Dynamik on 03-03-2006 02:03 AM
    When they give imbeciles handicap-parking, I won't have so far to walk!

  • SQL Command code for multiple value string parameter

    Hi,
    I'm using crystal 2008 and there is a check box for multiple value  SQL Command  I need some help in writing the SQL Command code  for oracle (or sql server) for a multiple value STRING  parameter.
    Thanks in advance,
    Marilyn

    I could be wrong here, but I do not believe you can pass a multiple valued parameter to an SQL Command data source.  How I have gotten around this in the past is to put the "real" report into a subreport.  In the main report, create a formula field (basic syntax):
    formula = join({?parameter}, "|")
    Then, use this to pass the selected values to the subreport's parameter (call it {?sr-parm}).  The SQL Command in the subreport can then use that (MS SQL):
    select *
    from table
    where charindex(table.field, '{?sr-parm}') > 0
    HTH,
    Carl

  • I would like convert a c++ dll for use in labview--my device has no labview dll

    I have a piezoelectric control board (Piezomechanik gmbh) that I would like to use through LabView.  Currently, the company does not offer any support for Labview.  Windows sees the device (It came with a driver file), but the company only provides dll files for C++ and Visual Basic.  Can I convert these files to a format Labview can use?  How can I get Labview to communicate with the control board (and ultimately the piezoelectric device attached to it)?  Thanks!
    Solved!
    Go to Solution.

    This will only help you when you have the header file for the DLL, otherwise you will have to create the wrapper manually using the "Call library node" and the DLL api description or write an header file for the DLL yourself based on the api documentation and use the wizard.
    Regards,
    André
    Regards,
    André
    Using whatever version of LV the customer requires. (LV5.1-LV2012) (www.carya.nl)

  • Building Dll for labVIEW RT gives errors

    Hi All
    Does building dll for labVIEW RT using CVI require labview runtime engine to be installed?
    becuase i get some errors of unsatisfied referances to some library while building the dll with target selceted to "labVIEW real time only".
    Regards
    Arun

    Hello Arun,
    You don't need to have LabVIEW Run Time installed on your machine. Please check the link below to see the function that are supported by exporting the LabWindows/CVI LabVIEW RT Engine
    http://digital.ni.com/public.nsf/websearch/D3EFE7C6F073384886256FDD005FBCDA?OpenDocument
    Ame G.
    National Instruments

  • Deploying labview dll for vb6

    Hello,
    I have created a labview DLL that uses the modulation toolkit. The idea is to use this dll in a VB6 project and this on a PC that doesn't have anything installed from Labview, only visual basic 6.
    To test my DLL, i have created a VB6 test project on my development PC (with labview + modulation toolkit installed) which calls this DLL. On my development PC everything is working fine. The problem starts when I try to run this VB6 project on a PC without Labview. First, he asked for the labview runtime engine, so I installed this and restarted my VB6 project. But if I try to run my project VB6 automatically shuts down.
    How can I create a VB6 project on a blank PC that uses my labview DLL?
    Thanks

    Well, as you've already found out, you have to have the LabVIEW Run Time Engine installed on this other PC. This is an absolute requirement.
    Unfortunately, right now there's too many variables, so the only other answer I can give you is that you should try to narrow this problem down by creating a simplified LabVIEW DLL and try to call it in your VB6 on this other computer. To be honest, I'm not sure whether not having the deployment license for the Modulation Toolkit on this other machine would actually cause VB6 to crash. I did a search on this site and didn't find anything. Still, I would suggest trying it out with the Modulation Toolkit first,  Then work your way up until you find where it breaks.

  • ActiveX wrapper for Labview

    Hello!
    My name is Daniel. I'm from Argentina and I work in Tracnova S.A.
    Tracnova is the Distributors of NI in Argentina.
    I am having an issue with ActiveX development for wrapper an dll driver.
    I have to read strain gage aquisition data from an USB device of MANTRACOURT (http://www.mantracourt.co.uk/products/wireless-telemetry).
    The manufacturer provide an dll driver. It's shipped with example for VB6 that I have been testing and it works fine.
    BUT I HAVE TO USE IT IN LABVIEW.
    My first problem is that I have to provide an CALLBACK function pointer as parameter to "INITIALISE" function of the dll. Here is an excerpt from the
    example that is shipped (Excerpt from a form module):
    Private Sub Form_Load()
        'we will only handle base station addresses of 1
        iBaseAddress = 1
        Caption = Caption & " [DLL v" & VERSION & "]"
        CLOSEPORT
        'set the callback so we can receive data provider packets
        Init AddressOf CallBack  ''''''----------------->>>>>>>>>>>>>>>> CALLBACK function pointer as parameter to "INITIALISE" (It defined as Init)
        'Open USB interface
        ok = OPENUSB
        If ok <> 0 Then
            ShowMessage "Cannot open USB interface!" & vbNewLine
        End If
    End Sub
    "CallBack" function is contained within .bas. Because You can only retrieve the address to a function or sub (public or private) contained within a
    Standard VB Module.  There's no way around this.
    Here is an excerpt from the example that is shipped (excerpt from a Standard Module):
    Sub CallBack(ByRef StringPtr As Long, Length As Long)
        Dim PBMsg As String, rc As Long, pEnd As Long
        Dim p(128) As Byte
        Dim cH As Byte
        Dim tID As Long
        Dim C As Integer
        On Error Resume Next
        CopyMemory p(0), ByVal StringPtr, Length
        PBMsg = Left$(StrConv(p(), vbUnicode), Length)
        'strip off the base station wrapper
        PBMsg = Mid$(PBMsg, 4, Len(PBMsg) - 5)
        If PBMsg <> "" Then
            Debug.Print CVStr2HEX(PBMsg)
            Select Case Asc(Mid$(PBMsg, 1, 1)) And &H1F
            Case PT_DATA_PROVIDER
                'pass data to the main form if we are not closing
                If Not Closing Then MainFrm.ShowMessage "DATA_PROVIDER Data Tag=" & Replace$(CVStr2HEX(Mid$(PBMsg, 2, 2)), " ", "") & " Data=" & Decode
    (Mid$(PBMsg, 5, Len(PBMsg) - 6)) & vbNewLine
            End Select
        End If
    End Sub
    Then, when an data packet arrived, the driver call to "CallBack" function instead, so I can process it and do what I need.
    But I can't pass pointer to function IN LABVIEW WITH "LOAD LIBRARY FUNCTION". So I did an ActiveX in VB6 for wrapping the dll of the driver. I attached the
    files tha I did. The ActiveX sends an event to labVIEW everytime that a data packet arrived. I trigger an event inside the CallBack function that it's
    not working, but if outside (look inside Iniciar() function where I wrote "This is the first event", the event trigger works.)
    Why is not THE CALLBACK FUNCTION TRIGGERING THE EVENT INSIDE THE LABVIEW??
    I also tried to make a Win32 DLL with C + + using PostLVUserEvent, but neither worked for me. I can send the code in C + + if you want to review.
    Thank you for your consideration. I look forward to hearing from you.
    Best Regards
    Daniel Lopez
    Design Engineer
    TRACNOVA SA
    www.tracnova.com
    Attachments:
    ActiveXPropia.zip ‏459 KB

    Thanks a lot nyc for your kind reply.
    Yes, you are right. They have COM driver, but the event does not fire in labview. Also, this driver does not implement a COM circular buffer which means that if you delay reading and processing the data, these are lost because they are rewritten. I have been asking for support to MANTRACOURT, but after several attempts, they told me they do not provide support for labview only for VB, VBA excel, and some other more, not even C + +     
    National I miss to much. Nice technical support !
    Please help, I need to fix this issue
    Thanks a lot!
    Daniel

Maybe you are looking for