spend a CVI to TestStand function reference tables

I need to switch tables (double, for example) a CVI function (usually a dll), return to TestStand.  and vice versa.

I followed a method that uses features of TestStand CVI such as 'TS_PropertyGetValNumber' and 'TS_PropertySetValString' and I understand how simple values, but the tables are killing me.   I do not see why it would be so difficult, so I must be missing something fundamental

Here is a simple example of what I'm doing.   I need to add a way to pass an allocated array of doubles (as declared and held in TestStand) in the CVI function where it is called 'values', have my CVI function fill this table of the 'values' and then pass the array back.

void TestStand_DUT_Transfer (CAObjHandle seqContextCVI, char reportText [1024],)
short * errorOccurred, long * errorCode, char errorMsg [1024])
{
error int = 0;
char response [DUT_TS_MAX_BUF_SIZE] = {'\0'};
Double delayResponse = 0.0;
ErrMsg errMsg = {'\0'};
ERRORINFO errorInfo.

get the double value of TS
tsErrChk (TS_PropertyGetValNumber (seqContextCVI, & errorInfo, 'Properties.Delay',
TS_PropOption_NoOptions, & delay));

/* */
/ * How DO I GET AN ALLOCATED TEST DOUBLES TABLE? */
/* */

Send command to the device, return a response string and double values table

DUT_TS_ErrChk (DUT_Transfer (delay, response, values)); //<=== here="" is="" "values"="">


/* */
/ * I PASS SUSTAIN HOW THE VALUES BACK to THE TEST BENCH? */
/* */

Send the char string to TS
tsErrChk (TS_PropertySetValString (seqContextCVI, & errorInfo, 'Properties.DUTResponse',
TS_PropOption_NoOptions, response);

Error:
If (error! = NO_ERROR)
{
DUT_Error_Handler (error, error);
* errorOccurred = TRUE;
* error code = error;
strcpy (errorMsg, errMsg);
}
}

Thank you for the review.

well, I received a response OR support.  I guess that's a common question since they have an example written, but for later use (since I couldn't find an answer by searching on forums), I will post it here:

\Examples\AccessingArraysUsingAPI\UsingCVI

Tags: NI Software

Similar Questions

  • Non-linear function Lev - Mar - output gradient functions reference table?

    Hello

    I have the whole 8.6 developer and am relatively new to labview.  First time posting, but these tips already have a lot of my problems solved.  Thank you!  My luck ran out however...

    I had worked on a recursive function to fit a set of nonlinear data, when I stumbled upon the function of lev - mar.  What a great discovery... it works very well.  However, I tried to determine the criteria for the named 'f '(X,a)' reference to the static VI which contains the lev - Mar function to fit the output.  The function performs fine without her that it will calculate the slopes in itself if the gradient table is empty, but it takes a little more time and I'm trying to speed up a bit.

    The example 'Fit Gauss surface with offset.vi' is the only example I could find where the output of f'(X,a) of the reference to the function VI is populated, but I'm a little rusty with my calculations and has failed to reverse engineer exactly what should be the values that they had classes in this table.

    I would like to be able to complete the table of f'(X,a) with the data of a 2d versus 3d surface curve in the example 'Fit Gauss surface with offset.vi.  Is attached a screenshot of the example showing the output in the example of f. '(X,a).

    Thank you very much!

    -Bill

    If you do not provide the analytical partial derivatives, LabVIEW will use automatically digital derived partial. You can watch the labview code in detail to see how it does, just open the VI and search for "LM digital gradient.vi.

    I don't know what, "recursive function" in this context, but they have an analytic expression for the partial derivatives?

    Even if the analysis of the partial derivatives are not possible, it may be an advantage to making your own derived partial inside the model. It seems to be much faster.

    You'd basically is to calculate the function several times, each time with one of the parameters that is incremented by a small delta and subtract function calculated with the current settings Plains each and divide the result by the delta. Do everything in a table 2D for the output of f'(X,a).

    The image shows one way to do this inside the model. The black square is a model where you replace you own function (f(x,a)).

    Let me know if you have any questions.

  • IMAQ vision function reference

    Hi all

    I'm new to Lab Windows/CVI and uses the library imaq vision.

    Could someone tell me where I can find the reference of function IMAQ Vision? I found a function reference manual at first--> National Instruments--> Vision--> Documentation. But all the functions described in this document are starting by img * (). I was looking for functions starting with imaq * ().

    I'm sorry that it might be a stupid question, but any help would be appreciated.

    See you soon,.

    Thanks Alex,

    I found the document

  • UIR-file not found (error 94) when executing dll CVI in TestStand

    I am trying to execute a dll that I created in CVI in TestStand.  I did have problems so far running all features except for the function that calls my user interface.  Whenever I run it, I get an "error 94, file '... 'not found' IUR.»»  This particular IUR is usually called in the main() function when I create an exe file in CVI, but I'm the appellant for another function to perform in TestStand.  Any suggestions on how to fix this?

    Hello

    You use the correct LoadPanel call. You must use LoadPanelEx().

    Concerning

    Ray Farmer

  • Module CVI written TestStand property, property value resets after the step execution.

    Hello

    I did a lot of research and find nothing relevant to the question that I have. I've created a DLL in CVI containing several functions I call TestStand. I also created a type of step customized for each function call. Every function in the DLL has a runtime version and a version edit-time. Time edition features each have a UI associated with them are called from teststand. Change these functions are placed in the custom under the heading "change" step step-type tab Before executing a sequence with these custom steps the edit-time user interface is launched to allow the user to input values that will be passed to the run function. originally, I tried to set up my functions as a 'post step' step in the step properties. However, the sequences would fail to run because the parameters of the step module was empty. Then, I selected CVI as the adapter in the step properties and specified a default module for each type. This filled the tab module settings step like I wanted. However, when I ran the sequence each function execution of measures was called twice, once for the stage of the post, and once for what was in the tab module I suppose. I then re-entered the types of step and deleted all the steps of the post office. I thought that all the problems have been resolved at this point, however, after doing some more extensive tests I always have a bug, I was unable to get rid of that.

    The problem is that two of my step types have to write data to current TestStand to execution after they ask an external device for IT. I know that the query works because my log text that generates the DLL displays the correct values. However, the data are not get rewritten on TestStand correctly. In the enforcement functions after checking the valid data has been returned, I try to write to TestStand using: "TS_PropertySetValNumber (seqContextCVI, NULL,"ThisContext.Step.ParameterValue.NumericParameter", 0, (double) ushortint);" »

    I checked that this call generates an error and also used the TS_PropertyExists method to check that I had the correct search string. These extract so I added then another command that reads the value written to TestStand two return immediately after to write it. I printed this in my log file and found that the value is written to the property of TS. So, the problem is that TestStand is defining the property to reset after the code module is running. How to prevent this?  

    Thanks for all comments, let me know if anything specified needs.

    Josh Meyer

    Well, I came to the conclusion that my 'problem' is not really a problem. I had a bit of a basic misunderstanding of the works of TestStand (I don't actually use it, I am writing just a code which will bring an existing one of the tools of the features inside the TS).

    in any case, what I learned is that these properties are retained (so you can set up a sequence, save it, re - open and be able to run it without any reconfiguration for example), when you write to a property when installing editting/sequence. The run time values are not preserved (if connected) because they are only required to carry out. For example, if a user calls one of these functions to extract value from a controller, they probably do so because they want to check the value, it's what they expect it to be. Rather than watching the value after execution (which is what I me assuming they would do), they would set up the step after step "read value" to test the value that it returned. This value is available in 'RunState.PreviousStep.valuename' in the downloaded step step "read value".

    Hope that I did not confuse anyone a lot, I'm completely new to TestStand.

  • Cascade of two functions of table build - what happens?

    I found the code indicated in the attachment in a very complex VI that I'm rehabilitated.  Could someone explain what is happening with the functions of table build "cascade".

    I see that the first function to build array built a table 1 d of integers that passes to the second function to build table that shows a table 2D of integers, but since there is no element or second input array, I don't see how it works.

    This is part of a Subvi, which is not incorporated into a loop.

    All the examples have at least two entries.  There is no option to concatenate entries with a single entry. There is an implicit operation here that I don't understand.

    If someone explain how it works?

    You're taking a scalar value and creating a table 1 d with exactly 1 element.

    So you're taking 1 d table and build in a 2D, with exactly 1 Item table.

    Since you can't concatenate something with nothing, only logical mode for the table build would be to build in a table of the next larger size.

    You could add a third, then you'd have a table 3D with exactly 1 element.  And so on.

  • How do the function of table 1 d search case-insensitive for the array of strings

    How do the function of table 1 d search case-insensitive for the array of strings

    Hi Karine,.

    convert the two (table and search for the string) to lowercase before using this feature...

  • CVI 2013 SP1 - function calls repeated with pointer on a variable array parameter causes a shift of the index

    I have some functions will be pointers as parameter and CVI 2012 SP1, they work as before without problems but with CVI 2013 SP1 they are now incorrect.

    Here the description of what is happening - I found a cure, but a duty adopt the old code and I think it's clear that nobody don't "captures" all lines in a 'big old code' which are affected (maybe):

    I have functions

    'function_XYZ(int *p_paraArr) '.

    with 'p_paraArr' as pointers on a table (int).

    Suppose I have another function

    "fct_TOP (void)".

    where is a local array variable which is inizialized by

    "int TheArray [25] = {0};

    and inside of this "TOP"-function-body I call a function ".

    "function_XYZ (TheArray).

    There are no complains of the compiler (CVI 2012 or 2013) and the code works (but the CVI 2013 only once!).

    But if I put 'fct_TOP' loop I have a lag in the "TheArray' -memory.  (The loop surrounds the function "TOP"! "")

    This means that the result "TheArray" obtained from "function_XYZ (TheArray)" starts at index '1' not on the index '0' - as the first time that the function "function_XYZ (TheArray)" was performed. ".

    The solution is:

    I only replaced

    "function_XYZ (TheArray)" (<1>)

    by

    "function_XYZ (&(TheArray[0]))" (<2>)

    overall the program now works every time (in the whole loop)-the first time (in the loop).

    In the second version (<2>) everything is necessary to "work well":

    The '&' and parentheses "(...)", which contains the element that may be designated by the '& '.

    And I hope that you believe me: I've tested several times, it was only "little" change that solved the problem.

    So it seems that the ICB 2013 (SP1) is a kind of internal offset index by a repeated execution of the

    "function_XYZ (TheArray).

    but I don't know how or why but I see in debug mode by observing the expected against the values in the table received!

    At the first time the (implicit) internal index of 'TheArray' is '0', but the following times (during the execution of the loop) the internal index passes to '1' (seen in the debugger because that all the expected values were shiftet like that!).

    So there's an explicit index in the table ("function_XYZ (&(TheArray[0]))") necessary to make the first time of this clear code execution.

    There are some good improvements in 2013 CVI (SP1) and I like this environment more than the 2012 version - but:

    There are other "changes" also, in the compiler (or linker...?) that are more rigid than "in ancient times.

    The problem of this kind of error is always the 'old code '!

    It is expected of such behavior.

    The compiler/linker do not complain (a complaint would be good!) writing but he made this mistake (in a loop).

    By the way: my 'compilation Options' are set to 'Extended' (without change in the "..." ("- button - Options) and that all of the boxes, except the" OpenMP_support "-box are checked!"» So I think that I put the very rigid compiler - maybe there are some «...» ' - button - settings to get rid of this problem, but I have not found them/it.

    My request:

    -Check the stiffer compiler by the need of an explicit index

    - or switch to the 'old' behavior with "function_XYZ (TheArray)" always refers to implicit index '0' of the element "TheArray". "."

    Thank you for your messages, comments and suggestions.

    -As I wrote before - maybe it's the style of programming or error"self made"... maybe...
    .. But if I replace 'function_XYZ (TheArray)' by "function_XYZ (&(TheArray[0]))" and
    then it works... Why so and not, if bothe the same? ...

    But as long as I do not post sample code, nobody is going to accept - I accept it. So consider this post more as an allusion to the fact that of the LW/CVI 2012-2013 LW/CVI more changed than just the LW - GUI or certain features: the compiler changed its 'way to'... or almost.

    For this problem, I think that I will use the solution 'use no implicit and explicit pointers'.
    Who should be a good idea taking into account
        http://forums.NI.com/T5/LabWindows-CVI/fatal-run-time-error-dereference-of-out-of-bounds-pointer/TD-...

    mybe also only caused by wrong code... who knows... but for me it is a sufficient reason to act as I suggest above.

    Best regards,
    F.

  • Store the Teststand ActiveX reference in the LV shift register

    It is posted here

    I'm trying to store the references TestStand ActiveX in a shift register not initialized a VI.  In my case, the references are passed into the TestStand VI (not created from in VI).  If I call the same VI to the next step (same sequence and execution of the previous step), since the shift register ActiveX references are not valid.

    The VI remains reserved to run during these two stages and is not unloaded from memory, so the shift register data should remain intact (in fact, the numerical values of the references are actually kept).  LabVIEW is still trying to close any ActiveX reference, even if they were not created from the VI?  Is there a way around this problem?  Or I'm just something wrong?

    jsiegel-

    In general, when the code is passed a COM reference and code is to keep the reference to a global or shift register, even after his return from the call, the code must add a reference to the object so that the object server knows that the object must be destroyed not. It is also the responsibility of the code that fits on the reference in the world or a register shift to release the reference to the object when it is no longer necessary.  LabVIEW is not different from any other language.

    So, here are more details. TestStand application LabVIEW for run the VI, TestStand after the reference as a parameter to the method of the server to run the LabVIEW VI. COM creates a proxy for reference and give the reference of proxy for the code module. Your VI then stores the value of the proxy reference in the global or the shift register. When your VI ends and returns to TestStand, COM releases the proxy reference, the value in the global or the shift register is no longer valid.

    Basically, you need to add or duplicate the reference to the object passed in LabVIEW by calling the VariantToData function. Pass the existing reference, set the input type to the same type of the reference, and the result will be the reference in doubles. You can assign the double reference to worldwide or register.

    Normally you must well to release the reference later by reading the value of the global or shift register, explicitly calling the function close reference with which to reference, and then assign A Refnum Constant stepped up to the global level or shift register to nullity. In the case of a module of code, I believe that when TestStand unloads the VI, LabVIEW frees the reference correctly. If this isn't the case, you will get a debug message to unpublished during the TestStand stop object if you have this option enabled.

  • Error PLS get a REF to an object and assigning to a "reference table".

    Hi all

    I have the following types. As you can see, the other refers to the other (circular reference). The only way I found to compile these two types is by using the 'TABLE OF THE REF IS". The case is more complex, but I show you here a test case that focus on the problem.

    ----------------
    create or replace the force
    type item_type as object)
    Identification number,
    VARCHAR2 (200) text.
    item_list elements,
    item_type function constructor return self as result);

    create or replace the force
    type item_list is item_type ref table;

    change the compilation of type item_type.

    change the compilation of type item_list;

    --------------

    She ended up compiling well... but when I need to use, and then pops up the error:

    ------------
    declare
    I have item_type;
    He item_list;
    Start
    i:=item_type();
    i.ID: = 1;
    i.Text: = 'hello';
    IL.extend;
    He (il.last): = i; -PLS-00382 expression is of the wrong type
    il(il.) Last): = REF (i); PLS-00306. wrong number of arguments in the call to "REF".
    end;
    -----------

    Note: I'm on an 11g database

    Thanks in advance

    resteller wrote:

    I agree, it sounds crazy, but I need the ability to store an ITEM_LIST in an ITEM

    As I said, you need a table of persisnet:

    SQL> drop table item_tbl
      2  /
    
    Table dropped.
    
    SQL> drop type item_list force
      2  /
    
    Type dropped.
    
    SQL> drop type item_type force
      2  /
    
    Type dropped.
    
    SQL> create or replace force
      2    type item_type
      3      as object(
      4                id number,
      5                text varchar2(200),
      6                items item_list
      7               )
      8  /
    
    Warning: Type created with compilation errors.
    
    SQL> create or replace force
      2    type item_list
      3      is table of ref item_type
      4  /
    
    Type created.
    
    SQL> alter type item_type compile
      2  /
    
    Type altered.
    
    SQL> alter type item_list compile
      2  /
    
    Type altered.
    
    SQL> create table item_tbl of item_type
      2    nested table items store as items_ntbl
      3  /
    
    Table created.
    
    SQL> insert
      2    into item_tbl
      3    values(
      4           1,
      5           'hello',
      6           null
      7          )
      8  /
    
    1 row created.
    
    SQL> insert
      2    into item_tbl
      3    values(
      4           2,
      5           'bye',
      6           null
      7          )
      8  /
    
    1 row created.
    
    SQL> insert
      2    into item_tbl
      3    values(
      4           3,
      5           'hello and bye',
      6           (
      7            select  cast(collect(ref(t)) as item_list)
      8              from  item_tbl t
      9           )
     10          )
     11  /
    
    1 row created.
    
    SQL> select  *
      2    from  item_tbl
      3  /
    
            ID TEXT                 ITEMS
    ---------- -------------------- ----------------------------------------
             1 hello
             2 bye
             3 hello and bye        ITEM_LIST(0000220208E499CBCA1C5C4AC3BF8C
                                    5DB2A793788A52BA08E86F44417E9E9E88DAD37E
                                    5A01, 0000220208963685994E5040CCB2E0DEB5
                                    F0D48DE152BA08E86F44417E9E9E88DAD37E5A01
                                    )
    
    SQL> select  id,
      2          text,
      3          deref(column_value) items
      4    from  item_tbl,
      5          table(items)(+)
      6  /
    
            ID TEXT                 ITEMS(ID, TEXT, ITEMS)
    ---------- -------------------- ----------------------------------------
             3 hello and bye        ITEM_TYPE(1, 'hello', NULL)
             3 hello and bye        ITEM_TYPE(2, 'bye', NULL)
             2 bye
             1 hello
    
    SQL>  
    

    SY.

  • Syntax error when you use FindIndex in TestStand functions

    Hi all

    I used this function well before that was functional for me, but don't know what I'm doing poorly able to do my work.

    This is my scenario,

    I have a local variable of the table 1 d of chain bear (Locals.XXX)

    I need to get the first value of the element

    I used the below syntax

    FindIndex(Locals.XXX,1,True)

    Advice me what I am doing wrong

    Thanks Charlie

    I will use another method to the same requirement

    Locals.MyArray [4] instead of find indexes

    Bravo for your support!

  • Boolean reference table

    How do I create an array of Boolean reference?

    Steve

    Hi 4BoysDad,

    You are eager to create an array of Booleans in LabVIEW?

    If so, you can place a constant matrix down, then place a Boolean constant inside the empty array. This will turn it into an array of data type Boolean. Then you can stretch the table to add/remove the number of items in the table (or use the up/down arrows index).

    If you try to do that in something else than LabVIEW, let me know.

    Also, for any future reference your post will get more action if you post them in the appropriate sub-forum. This forum is for our DSA material, post it in the forum LabVIEW will result in faster responses.

  • TestStand directly accesses table generated in LabView? How to do?

    Hi all!

    I am a new hand to TestStand, so I have several problems.

    I generated a digital picture in LabView and dynamically display in the chart. When I want to use TestStand to generate the report, can I go directly to the table? Otherwise, how? My ultimate goal is to display the chart as a chart in the report.

    Thanks a lot for your help.

    You have several options here.  Pass the transom to TestStand and save it as an additional result. Or you can just put a picture of the LabVIEW Control in the report.

    Option 1: https://decibel.ni.com/content/docs/DOC-38945

    If you use Option 1 it is important to understand this: http://digital.ni.com/public.nsf/allkb/7AE2EB304D4F9D4F86256B8100795B83

    Option 2: http://www.ni.com/example/30736/en/

    It also depends on what version of TestStand you use as well as the type of report you want to generate.

  • Call a DLL in TestStand by reference

    All,

    I developed a DLL that control a USB based power. The call of the dll works from TestStand 4.1 most of the time. What I think is happening, is that whenever I call the dll in my main sequence of the file as well as other files in sequence, as several instances of the dll is loaded.

    Part of the init of food must pass back a SESSION number that is used in subsequent calls to the dll. I store as a global variable in TestStand and pass around sequence that never he needs.

    How can I load the DLL at the beginning of the sequence and PASS a reference (handle) to all other calls to the dll?

    Thanks in advance

    Carmine

    Doug,

    Thanks for your help. I found a UnLoadModules() in one of the child seq that I missed. Unless I missed all the others, I think this should be resolved.

    Carmine

  • find the memory leak when switching from Teststand object reference to vi

    I use Teststand to call labview vi and col ThisContext sequence to vi as object reference, but if I just completed this step and I can find the memory to help keep more, how can I avoid leaks memory inside the vi.

    See my vi, is displaying an interface message user.

    You should use a node reference close to close the references that you get after an invoke. In the code below, you should be able to close the references that you get the following:

    AsPropertyObject

    Thread

    Close these two references, once you're done with them.

    Also make sure you have turned off the collection of results of your sequence or you will use memory constantly to the results of the stage.

    Hope this helps,

    -Doug

Maybe you are looking for