VxWorks: LabView LStrHandle structure

Hi all!

I want to receive a bunch of vxworks for LabView.

Is it possible that when the Cluster-> String initialized?

It is seems the code "c-> s = (LStrHandle) malloc (sizeof(void*));" is incomplete. LabView requires something else. But which requires LabView?

CODE:
#include
#include
#include

typedef unsigned long int32;
typedef char Char;

/ Pascal-style strings types. */
typedef struct {}
Int32 cnt;        / * number of bytes following * /.
Char str [1];        / * cnt bytes * /.
} LStr, * LStrPtr, * LStrHandle;

typedef struct
{
S LStrHandle;
} Cluster;

extern 'C' Sub changeStr (Cluster * c, LStrHandle lvs)
{
does not work
c-> s = (LStrHandle) malloc (sizeof(void*));
* c-> s = (LStrPtr) malloc (10);
(* c-> s)-> cnt = 3;
strcpy-> str, 'bad' ((* c-> s));

works
* VL = (LStrPtr) malloc (10);
(* lvs)-> cnt = 6;
strcpy-> str ((*LVS), "works!");
   
return;
}

Kolan wrote:
In other words, is it possible to implement the NumericArrayResize function on vxworks?

Why do you put NumericArrayResize on vxWorks? This function is provided by the kernel to run LabVIEW and you can call it simply from your own C code.

Tags: NI Software

Similar Questions

  • How to declare a pointer to the element of structure, i.e. the table structures

    LStr, * LStrPtr, * LStrHandle structure is taken from the extcode.h of cintools of LabView
     
    I used: sprintf (((*(*in_array)-> Strings [* count])-> str), local_str); for local_str string to
    Table of LabView.  It worked well, but a single programmer advised me to change the code to be more readable.
    Means - to change (*(*in_array)-> Strings [* count]) of construction to a pointer. I tried several different
    ways to implement this - but in all cases it caused LabView crash. I understand that this question
    is related to the C not on LabView programming, but you could point me to the place where I error?
    The incorrect string is probably "LV_array = & (*. ((**in_array)))" Strings [* Count])); "
     
    Thanks in advance.

    1 typedef struct {}
    2 int32 cnt;            / * number of bytes following * /.
    3 uChar str [1];         / * cnt bytes * /.
    4} LStr, * LStrPtr, * LStrHandle;
    5.
    6 typedef struct {}
    7 int32 dimSize;
    8 LStrHandle string [1];
    9} LVStringArray;
    10.
    11 typedef LVStringArray * LVStrArrayHdl;
    12.
    13 _declspec (dllexport) void avg_hello (int * count, LVStrArrayHdl in_array)
    14.      {
    15.
    16 unsigned char * local_str = "entry function ma_in();
    17. (* County) = 0;
    18 LStr * LV_array;
    19.
    20 LV_array = & (* ((**in_array).)) Strings [* Count])); Address to which to point LV_array
    21 subfunc(count, &in_array);                      Call a function that resizes the table (work)
    22 sprintf(LV_array->str, local_str);              by passing the string to LabView (does not work)
    23.
    24.}

    Thanks Andrey Dmitriev! spasibo!

    With your example, I realized where I have error in my code:

    I tried to assign the address of string pointer that has not yet been preallocated!

    that string permutation just means get us final code:

    1 typedef struct {}
    2 int32 cnt;            / * number of bytes following * /.
    3 uChar str [1];         / * cnt bytes * /.
    4} LStr, * LStrPtr, * LStrHandle;
    5.
    6 typedef struct {}
    7 int32 dimSize;
    8 LStrHandle string [1];
    9} LVStringArray;
    10.
    11 typedef LVStringArray * LVStrArrayHdl;
    12.
    13 _declspec (dllexport) void avg_hello (int * count, LVStrArrayHdl in_array)
    14.      {
    15.
    16 unsigned char * local_str = "entry function ma_in();
    17. (* County) = 0;
    18 LStr * LV_array;
    19 subfunc(count, &in_array);                      Call a function that resizes the table (works), firstly resize us the table, and only after that can we assign a string address to a pointer

    20 LV_array = & (* ((**in_array).)) Strings [* Count]));  Address to which to point LV_array assignment
    21.
    22 sprintf(LV_array->str, local_str);              by passing the string to LabView (does not work)
    23.
    24.}

  • Case of Structures run a particular set of code for several conditions?

    Structures of the event may have a single case of event manage several event specifiers.

    C code supports this kind of statement 'switch ':

    Switch (EnumValue)
    {
    case a:
    case b:
    handleAOrB();
    break;

    case c:
    case d:
    e case:
    handleCOrDOrE();
    break;

    by default:
    handleOther();
    }

    How about Business Structures? Can I attach a code block to multiple values to enums? (without duplicating cases, which might be a maintenance nightmare)

    Edit: the closest thing I found is http://forums.ni.com/t5/LabVIEW/case-structure-multiple-inputs/td-p/2377132, but my original enum in another conversion is a bit rude

    You can specify multiple values enum for a particular case. Is that what you're looking for?

    For more information, see the series of weekly nuggets that I wrote on the case Structures: part 1, part 2, part 3, part 4and part 5.

  • Enqueue cluster for Labview Teststand, return a cluster by notification

    Hi all

    I get very very frustrated that I can't find a way to spend

    an asynchronous VI with a cluster of Teststand reflecting a LV

    cluster using a queue.

    This works if wire you the cluster Teststand for the VI is there

    an order appropriate to link to. Yet, the VI has no

    Connector, he expects that a cluster in queue, read of the

    PropertyObject by 'GetValVariant', do some magic

    and is supposed to return another cluster using Teststand

    a notification

    I can read singular elements of the cluster in queue, but cannot

    Run in a cluster of LV with, say, the good old 'VariantToData '.

    which indeed works great inside LV

    Same thing happens when I try to regain a Teststand cluster

    using 'SetValVariant' even if both the Teststand cluster

    and the cluster of LabView are the same format and structure.

    The 'Wait' Teststand notifier action is linked to the right cluster

    property, but Labview fails at the "SetValVariant", because not of

    the right type, even if I have sunk the variant data.

    I wonder if I do wrong or Teststand and Labview

    are simply not designed to work together seamlessly.

    Here's the example I'm putting in place, but the reading of the

    cluster fails, while the alternative 'False' works (123.00)

    Defining the notifier cluster fails too, but its definition the

    elements indivualy also fails because Labview is

    What are 'Compliance' and 'Comments' in

    the 'True' alternative, although I tried all

    hierarchy tree.

    You might have figured out, but I really really need to

    get this working, and I can't understand where the

    default is (next between the Chair and the keyboard) because

    the principle works in LabView.

    David Koch

    Okay guys, I give up all hope, that I had to do this work.

    This is a WIP Teststand container/Labview cluster motor relay.

    TestStand 2013-> TCS_main_2.0.4.seq (run TCS_teststand_2.0.0.vi)
    LabVIEW 2013-> TCS_teststand_2.0.0.vi (run TCS_instruments_2.0.0.vi)
    LabVIEW 2013-> TCS_instruments_2.0.0.vi (interface instruments)

    The main idea was to catch Teststand queued of containers,
    convert a Variant, to analyze their structure and
    to match with their counterpart of cluster of Labview.

    The engine is initialized to 'learn' the Labview
    data structures, storing the data type and the names of the clusters
    different elements, as well as the cluster hierarchy.

    A format of target data type and an associated action are also
    stored for each identified cluster/container.

    Then the engine is waiting for incoming Teststand queue
    containers, convert them to a Variant, to analyze their
    structure and * TRY * to match with the stored
    having been analyzed Labview homologous groups.

    This is what I call the "footprints".

    The three main problems were... are:

    1 - different naming convention (TCS_string_teststand_name_convert_2.0.0.vi)

    2 - format of different data type (TCS_variant_tree_convert_2.0.0.vi)
    3 - different (TCS_propertyobject_tree_parse_2.0.0.vi) data structure

    I think I was very close to resolving these issues, but I'm
    short on time. As an entrepreneur, I've spent
    more than a month of work on this value. Who is
    too many given my dead line.

    I'm quite sad to be leaving this unfinished, he would have
    was great to get the motor relay pole upward and
    running, having just to place a container Teststand
    to get something done automatically at the other end
    and just wait for a notification sent for analysis.

    What's left to do is the following, as an exercise
    left for the reader:

    To "explode" the data structure to correspond to of Teststand "
    still more verbose simpler data format

    This means for example that a Labview wave have to
    be transformed into a cluster of 3 datas. You can read the
    suite of document, but it is not very clear on how
    The LabVIEW data type formats are converted to their
    corresponding Teststand counterpart:

    http://zone.NI.com/reference/en-XX/help/370052N-01/tsref/infotopics/labview_data_types/

    Beware, this involves a lot of trial and error, as
    creating a large Labview cluster with all data
    type of support, import it in Teststand and create
    a custom, data type and then compare each converted

    a data type.

    B point A would improve the adequacy between Teststand
    containers and clusters of Labview.

    With a longer data structure mirrored, it will indeed
    help 'TCS_fingerprint_search_2.0.0.vi' to compare
    the structure of the Teststand container with the correspondent
    LabVIEW cluster structure, the elements names
    Always different Convention.

    Conversion of data format C - needs to be done, place holders
    are ready to be filled.

    There are still a lot of work to do in 'TCS_variant_tree_convert_2.0.0.vi '.

    Remember that the type of data "FileGlobals.tcscluster".
    mirrors (wise Teststand) the 'TCS_instruments_2.0.0.ctl '.
    type definition.

    This means that a string has not transformed a waveform.
    Data format should be very close to each other. That's why
    There is no need to focus too much on these "exotic" data
    format conversions.

    Thanks again to all the people who have invested some time
    in trying to help me solve this issue.

    Thanks to nathand for its cluster monitor not recursive.

    David Koch

  • use a C++ DLL in LabVIEW

    I have a DLL that has been written in C++, and the typedef in C++ code is defined as:
    CY_BUFFER
    Definition
    typedef struct
    {
    int size;
    char * data;
    } CY_BUFFER;

    There is a function that should return the number of version as shown below:

    C function
    Version CY_INT (CY_BUFFER * buffer);

    A sample of code C to write to call the DLL is listed here:
    Example in C
    #include "cy_runtime.h".
    const int CUDA_DEVICE = 0;
    If (Initialize (CUDA_DEVICE)! = CY_SUCCESS)
    Returns - 1;
    Buffer CY_BUFFER;
    If (init_buffer(&buffer)! = CY_SUCCESS)
    Returns - 1;
    If (version (& buffer)! = CY_SUCCESS)
    Returns - 1;
    If (free_buffer(&buffer)! = CY_SUCCESS)
    Returns - 1;

    I have built wrapper LabVIEW using the DLL import wizard, but may not know what I have to do. I read the pointers to C/C++ dll dereferenciant in LabVIEW, but I do not understand how to use. Y at - it someone who can point me in the right direction here.  I can't edit the C++ DLL, but I don't know in theory, only the types of data, I just may not know what the wizard trying to do when he created the GetValueByPointer VI code it generates automatically.  If its C++, do I need to not use the wizard at all and create from scratch?  Any help would be appreciated gratefully.

    In addition to what Nathan said, you probably have an alignment problem. C compilers tend to align the elements in a struct to their inherent normal size. This means that the char pointer will be aligned to 4 bytes when you use LabVIEW 32 bits and bytes 8 when you use LabVIEW 64 bit. Now since the DLL also provides the init both the free function, this makes things a little easier. You can simply create an array of 4 integers from 32-bit bytes, pass it as a pointer to array to the function init() and version() free() and the only thing you need to do before release called an additional function of MoveBlock() where you adjust the offset in this table for the number of bits of LabVIEW.

    This involves a number of things:

    (1) your struct is indeed using 8-byte alignment, which causes the pointer to the byte offset 4 in for 32-bit LabVIEW and structure at byte offset 8 for 64-bit LabVIEW. Are you of any changes by using 64-bit LabVIEW, now that you have these 4 additional elements of the cluster between the size and the pointer?

    (2) in fact, the size in the struct element specifies how much data is in the buffer tank.

    And for the functions of the DLL error handling was completely omitted. To match the C code, you have shown that you should always check the function returns the value too before continuing.

  • Call the function in LabView from a DLL, and then access the global variable of DLL

    I've created a DLL in LabWindows with a function and structure.  I want to call the function from LabView and then access the overall structure.  I am able to call the function in the DLL with a "call library function node" and has access to the return value, but I can't understand how to access the overall structure.  The structure is declared in the header DLL with __declspec (dllimport) struct parameters file.

    Is it possible to access this structure without using the library of network variables?

    My guess is that you need two bytes of padding after "in_out" and another to two bytes of padding after "anin."  The reason being that ints are 4 bytes, and most of them C compilers will align on 4-byte boundaries.  The struct will naturally start to such a limit (in fact, in Windows, it will probably start to an 8 byte boundary).  If you then count bytes in your structure, you are 70 byte after "in_out."  70 is not divisible by 4, so you need 2 bytes more to reach the next 4 byte boundary.  You can also you could reorganize your struct so that "anin" follows "in_out" and this is probably the best option if it won't cause you other problems.

    Unlike most C compilers, LabVIEW compressed structures as closely as possible, without filling.  I don't know enough about the history of LabVIEW and internal parts to explain the reasons and to do this performance penalty, but, as choice of LabVIEW "endianness", it is probably a remnant of the first versions of LabVIEW that were running on the Mac.

    If for some reason you want to force your C struct to match package LabVIEW, you can use the #pragma pack (x) directive, but I wouldn't recommend that here because you can control the C and LabVIEW.

    EDIT: in the cases where it was not clear, add padding to your cluster of LabVIEW, insert appropriate size or items at the place desired in the cluster.

  • Location of the file of LabVIEW for Instrument custom

    We have a DLL for a developed in-house CAN interface we call a HOLY area.  One of our engineers has written a DLL it and uses in the testbed.  We were hoping to use LABView.  I guess I have two questions...

    1. If it works on test bench, can expect us it to work in LABView and...

    2. where we should place the DLL within the LABView directory structure, so you can access...

    Something else I'm missing...?

    Thank you and best regards,

    Greg Simopoulos

    317-879-6574.

    1 Yes

    2. everywhere where you have to test should work fine, when you create the screw to access the DLL, you can specify the full path to the DLL. That said, there probibly would be preferable to have it for DLLs in the system directory of Windfows. Because it is a known path, all you have to do is to specify the name of the DLL.

    Mike...

  • event structure and while loop iteration

    Hello

    It took me time to identify the problem I have, but I think I've nailed it and need help to solve.

    I am right to say that a while loop that contains a structure of the event will travel only once and then wait for another event to occur before a loop again?

    The question I have is that I need mark to a timestamp of a data acquisition driver (DataTaker) value, and whenever he changes the Labview event structure would take care of the rest of the incoming data.

    So is there a way to make everything in continuous loop on questioning my value of timestamps from my Datataker driver so that I can create an event Value (Signaling) for the Structure of the event to take care of?

    Thank you

    Richard

    Two options.

    1 put the stuff event to query a regular base in its own while loop that runs in parallel to the loop containing the structure of the event.

    2 put the stuff that you need mark in the case of delay of the structure of the event and a thread time-out value in the upper left corner of the structure.  Now, if no event to occur in this time, the structure of the event will run the case of timeout and the loop will iterate again.  The only problem with this method is that the case of timeout to run irregularly, or never at all if it turns out that events come more frequently than the timeout value.

  • create the code with this code snippet

    I'm curious...

    I can't create a snippet of code with this code. (located in the first post)

    http://forums.NI.com/T5/LabVIEW/event-structure-with-value-changes/m-p/1937505#M646059

    However, I can create excerpts of its subsections.

    Tried different versions of LabVIEW with the same result.

    Can someone create a snippet?  Just curious.

    I'm not stuck or anything... just curious...  Maybe I should have posted the breakpoint...

  • Design of menus using the Manager of events and containers

    I will review my menu interface using a Labview event Structure that has a lot of control on the tab pages.  I want to start making the correct design here approach.  By registering to the façade of the controls [] property as an event, I can write cases of the event for each of the controls on the front panel.  However, I have run into trouble when I have controls on the tab pages.  I have attached a VI that shows how I want to set up.  The event hanlder fires when I change page in the tab control.

    What is a good way to be able to decipher individual controls in the tab control and

    What is the feature (label, Ref number, etc.) that I should write the case of event on for the maintenance of good code?

    Looking at your code, you registered for the events of changing value for controls on the front panel, not in the tab control. Use the node property for the control to the tab to get references to the pages and each page get the references to the controls on this page. Build an array of all the controls on all pages (or you can separate registration for each page to make your life easier potentially) and register these controls for the value change events. See below...

  • Questions: licenses and have the availability of the DSC module

    Hello

    I transferred to another PC development project. When I opened it, some of my shared network variables (NSV) have been marked with errors of functionality: "Initial value: not allowed or can not be changed outside of LabVIEW.". I found out it's because I didn't install the DSC Module on the newer machine. removal of the function 'initial value' made the error message disappear.

    That the error itself was not a big deal, but it made me think and study. http://www.NI.com/white-paper/4679/en says:

    If you want to use the LabVIEW DSC Module features, you must host variables shared on Windows. The LabVIEW DSC Module adds the following features to network-has published the shared variables:

    · History by connecting to the database OR Citadel.

    · Network alarms and alarm logging.

    · Scaling.

    · The user-based security.

    · Initial value.

    · The ability to create custom I/O servers.

    · Integration of the LabVIEW event structure with the shared variable.

    · LabVIEW VIs for programmatically control all aspects of the shared variables and the shared variable engine.

    Question 1

    I didn't know that the initial value function was part of the DSC Module. If I use it in a project, means that my client needs to buy a DSC run-time license? (I don't use another function DSC)

    Question 2

    In my project, the NSV in question was hosted on a target of cRIO, yet my prototype (which had an initial value enabled) was happily running without problems. This contradicts the above documentation that says «you must host variables shared on Windows» Should it?

    Question 3

    I created a new NSV on my new machine (which has not installed a DSC). I saw the option of "Graduation". Is scaling part of the DSC module or not?

    Question 4

    Initial value and the scale are generic features, not related to the control of monitoring/recording of data. Why are they in the DSC Module? They do not in the motor base of the OAS?

    Hello

    1 Yes, whole generation using DSC features require a run-time license.

    2. This is a recommendation for more reliable operations.

    3. No, it's a native capacity of LabVIEW. DSC module adds just more features related to communication protocols, alarming, etc.

    4 development, Yes. Scaling, no I think is for easy access. Old school method is shown in here to the section 'initialize Variables shared your»

    Visit this pagefor more information on DSC.

  • "Control terminals on component connector not on the level superior. block diagram" to comment on the report of the ADC

    Hi all

    Could someone enlighten me please, what does this comment on the value of the ADC

    "Terminals on component connector not on the block diagram of higher level of control.

    This means that some terminals is hidden within certain structures of the case and does not show not not the diagram without going into the structures of the case or by 'higher level block diagram', it means

    main.VI and main.vi controls must also be connected to the connector pane?

    Thank you

    K.Waris

    On the one hand, this means that they run on your screws VI Analyzer, since it is a warning in extenso you receive.  This means simply a terminal which is connected to the ConPane is not on the top level diagram, IE. within a structure of housing.

    As to why he is often not a good idea to do that read this classic thread:

    http://forums.NI.com/T5/LabVIEW/case-structure-parameter-efficiency/m-p/382516#M191622

  • Shared variables, analysis engine and multiple targets

    I'm looking for some general tips on my LabVIEW project structure.

    The project consists of a laptop with LabVIEW, a connected joystick and a CompactRIO connected via ethernet. I ran the cRIO mode Interface FPGA, but a change in some things causes the project to have be moved to scan mode.

    From now on, the code on the portable computer updates the shared variables on the cRIO and bed from the variables shared on the cRIO for surveillance. I want to shared variables on the cRIO because he will also need to work without the connected laptop. Before moving the cRIO for scan mode, I found that I had to first run the code of the laptop and then run the code cRIO, or shared variables would not release properly. Now that I spent to scan mode, I have to run the code cRIO first, and even then the shared vars do not properly communicate for more than a few seconds and are well laggier.

    My ideal project solution is a system that can operate with or without the connected laptop and obviously do not have these questions shared variable. I would like the autostart code on the cRIO and ask the user to execute the code of the computer laptop, if necessary, but in the past, it doesn't seem to work with shared variables.

    I'm really confused about why this is happening. I hope I explained my problem well enough. I really don't want to display the entire project here, but I can email to people if they are willing to take a look. Thank you for taking the time to read this.

    I'm under LabVIEW 2010 SP1 with FPGA, DSC modules and robotic in real time. I have the updated Feb 11 driver and NOR-RIO 3.6.0 installed and completed all updated on my RT cRIO.

    I do this kind of thing all the time...

    Move all your NSV libraries on the cRIO.  Of the project, you must deploy on the cRIO and then they are persistent until you reformat.

    Your windows GUI application, you can set static NSV tags on the block schema or use the API SV dynamic R / w.  Also you can bind GUI controls and

    indicators directly to the NSV cRIO (it's what I do) also I create a library of 'mirror' in the PC HMI that is linked to the library of cRIO.  This library has DSC Citadel

    data record enable and automatically records the historical traces of all my important data - very nice.  Libraries hosted PC can be set to autodeploy in the version of the app.

    the project also has an option of autodeploy to the development environment that normally, I turned off.  If you have a PC at the cRIO binding configuration so be careful

    on any kind of autodeployment because this will eventually force the cRIO app stop when you deploy.  To work around this problem, you can use the PSP (IP address rather than project binding

    process name) and use of the DSC deploy library s vi in your HMI application.  Once you use the scan engine, you can use the app DSM (Distributed System Manager) to view, DIF and

    each of you IOV and NSV graphic on your network.

  • Reinicializar table con boton

    How I can reinicializar a table (eliminate todos sus elementos) cuando UN boton as tengo asociado pulso a una evento structure? Still use Labview 7.10.

    Gracias

    Hi Hillman,

    Finally, you have here my code "final." Now, I need to apply it in my program.

    I will work to understand the Labview code structure and the use of tables, hopefully I'll be at a practice OR next June session.

    I thank very you much.

    Harlock

  • using the structure of the event in the LabVIEW classes

    Hello

    I'm new in the use of LabVIEW classes, so don't know much how I can use them.

    In my main program, I have clusters with five elements in each. The elements are controls two States and in some groups, there are three States controls. The user will press the buttons (controls), and different things will happen. In my first program were I not using classes, I had a structure of the event and the controls were cases of event in the structure.

    Is it possible to somehow use an event of cases in one of the methods that is created in the classes, so that say, that's not in the main program?

    I have attached two photos: I wanted to have a structure of the event in servoTouchEvent (in left.tri.lvclass) who is a child.

    Let me know if my explanation is not clear.

    Grateful for the help!

    Hello

    Yes, you can have a structure of the event in a Subvi rather in your main VI of top-level UI. The trick is to use the 'Save for events' and passing in references to orders that you want to have the event trigger structure for. The refnum output since the function is entered in the terminal of dynamic event of the structure of the event who could live in a Subvi. You can add instances of event where you will see these control events as dynamic events then you can do something with. These excerpts from shows all the code in a simple diagram, but the stuff in the structure of disable diagram could easily transformed into a Subvi:

     

    All this can be done without classes. What will buy classes you include the ability to encapsulate your screws and also perform different code based on what object on the hierarchy of the parent-child classes is on a wire. If the behavior of your code is different between 2-3 State and controls (which I do not know what state controls 3 you are referring), you can take advantage of the classes.

Maybe you are looking for

  • computer shows no mixer installed devices, but have distorted from speakers

    A couple of days, I could hear the music of my speakers and then the music stopped. And all I can hear is coming from my speakers crackeling. I am disabled and it is difficult for me to left and right click. Computer said I have no mixer device. and

  • EA3500 Limited and unavailable 192.168.1.1

    We moved a week ago, and I'm trying to set up my system exactly as it was before. I have my router connected to a cable modem that we have, so the only thing that has changed is the address IP Comcast providing service to the House. I tried to use th

  • Color washes out when I turn on the computer.

    While using the computer on 06/10/10 a update, kicking, after re starting and as an elements began the screen becomes normal for an aspect faded as if 90% of the color was cleared on. I brought back to the restore point but everything is ok, but the

  • XPS 13 Haswell 256 to 1 TB SSD upgrade

    I bought an EVO TB Samsung 840 1 to uprgrade my SSD XPS 13 256, as I was runnning out of space. The laptop has the previoiusly been completely saved including emergency bootable USB I have the new 1 TB SSD in an external USB enclosure I would like to

  • How to move a container to another container

    Hi all, IAM using mutiple containers in my app now, I want to move one container to another by clicking on the button. How can I add action listener and move it to another container in the same page. Thanks in advance