How to use shared variables?

Hello..
        Can anybody please guide me in using shared variables... I'm learning LabVIEW 8.5.... But did not understand how to use shared variables... I tried to read web pages regarding shared variables but got confused.... So anyone can please help me...?
         Thanks for any help from you...

You will have to give us the whole picture. What is your client computer; a PAC, desktop etc? What are you running on the client computer; a VI or an executable? Where are you going to deploy your library? On the host machine or the client machine?
If I assume that you are running a VI on the client machine and are depolying the library on the host, all you have to do is to create another shared variable and bind it to the variable on the host machine. You can do this by checking the Bind to Source option when creating the variable and browsing to the network item in options. Be sure to have the library deployed on the host side before you attempt to do this otherwise you won't be able to find the variable.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies

Similar Messages

  • How to use shared variables to address multiple Watlow controller​s on the same COM port

    Hello,
    I am trying to use LabVIEW 2010 to control 4 Watlow temperature controllers on one COM port. 3 are Model 96 and 1 is an EZ zone controller. Each controller has a unique modbus address, and I am trying to read from and write to individual registers (such as closed loop setpoint) using shared variables. I am getting return data when reading (although the data appears to be invalid), but am unable to change the value in the register by writing. How can I be sure that the Modbus server is sending commands to the correct controller?
    Chuck
    Solved!
    Go to Solution.

    Peter,
    Thanks for the reply. I have actually solved that problem. I realized that the Modbus server address has to be the same as the controller's Modbus address.
    I have, however, run into another problem. Perhaps you could help me with that. I have a system with 4 Watlow controllers, 3 are series 96 controllers, one is PID only and 2 are ramping. The 4th controller is an EZ zone. I am using RS485 for communications and the controllers are all wired in parallel for communications and power.
    I have set up 2 Modbus servers for 2 of the controllers.
    This is the first I have ever worked with Modbus based communications. I have successfully programmed using the Modbus read/write VIs, and am wanting to move to shared variables. My questions right now revolve around addressing, Modbus I/O servers and COM ports. Specifically, at this point, I know the addresses need to match up between the server and the slave device (Watlow controller in my case), how many servers can I create and use on one COM port? If the number is limited, is there a way I can specify an address that I want the server to talk to? Will the broadcast mode work to request data values from the controllers?
    I'd appreciate any information you can help me with, or if you could point me to some sort of concise 'How-To' for Modbus communication.
    Thanks.
    Chuck

  • How to use shared variables with native c programs

    Hello
    What is the way to use shared variables with native c programs?
    I have a c/c++ program that uses the NIDAQmx C-API to perform measurements. Now I want to communicate to a LabVIEW program via shared variables.
    Is there a C-API for shared variables as there is for the NIDAQmx functionality? Where can I find further documentation? The document "Using the LabVIEW Shared Variable" mentions that one "can read and write to shared variables in ANSI C", but there are no hints about how and where to look.
    Thanks in Advance

    Hi user42,
    with CVI 8.0, you cannot create or configure shared variables. However, you can read or write to an already configured LabVIEW 8.x shared variable from CVI using the DataSocket API.
    In order to do this you need to have and DataSocket 4.3 or higher installed.
    Here's a forum post about using the DataSocket functions a LabVIEW Shared Variables:
    http://forums.ni.com/ni/board/message?board.id=180&message.id=24569&requireLogin=False
    With CVI 8.1 and Measurement Studio 8.1 it's possible to use Shared Variables via the Network Varaiable Library (check out the end of the "Network-Published Shared Variable" section within the "Using the LabVIEW Shared Variable" documentation and the following link).
    Datasocket with LabWindows/CVI and LabVIEW Real-Time:
    http://digital.ni.com/public.nsf/allkb/CC4343488413A2F586256E6200099638?OpenDocument
    Daniel
    NIG

  • How to use shared variables to measure analog input

    Dear All,
    I am using Real time remote system. I am using PXI-6259 card, PXI-8184RT controller and PXI-1031 Chassis.
    I want to use shared variable to measure and analog Input(voltage) from
    an analog input Channel.  I tried  attaching it  with the physical
    channel using the bind to source option but it idoes not seem to work,
    can any one give me any suggestions?
    Screen shot  of this is available.
    I tried using the Acq and graph example and deployed it to the RT but
    the Sine wave I input in the measurement channel  becomes highly
    distorted when I see it in the host.vi, there is also a Screen shot of
    this also. Is there any other option.
    What am I doing wrong? all suggestion are highly welcome.
    Thank you.
    Sincerely,
    Munir Afzal Bhatti.
    Attachments:
    SV2.jpg ‏2305 KB
    SV3.jpg ‏2305 KB

    You will have to give us the whole picture. What is your client computer; a PAC, desktop etc? What are you running on the client computer; a VI or an executable? Where are you going to deploy your library? On the host machine or the client machine?
    If I assume that you are running a VI on the client machine and are depolying the library on the host, all you have to do is to create another shared variable and bind it to the variable on the host machine. You can do this by checking the Bind to Source option when creating the variable and browsing to the network item in options. Be sure to have the library deployed on the host side before you attempt to do this otherwise you won't be able to find the variable.
    Adnan Zafar
    Certified LabVIEW Architect
    Coleman Technologies

  • Upgrade to 8.5.1 on all computers using shared variables?

    Hello,
    We are currently using DSC 8.5 and hosting the shared variable engine on one 'server' computer with other computers subscribing to network shared variables.  Some of the computers are Windows XP and others are RT.
    When we upgrade to DSC 8.5.1 can we just upgrade the 'server' computer and leave all other computers at 8.5 or do we need to upgrade all systems to 8.5.1 at the same time?  Will computers running 8.5 be able to read/write network shared variables hosted on the DSC 8.5.1 system?  Is such a progressive upgrade not advised?  Thank you in advance.
       - Chris White
         ThinkG Consulting LLC

    Hi Chris,
    The variables pass through the Shared Variable Engine on your server before they are read by other subscribers. Therefore, you do not have to upgrade the DSC on all your subscribers. I hope that answers your question. For further reference on how network pulished shared variables operate as well as the role of the SVE, please refer to this link.
    Ipshita C.
    National Instruments
    Applications Engineer

  • About the performance of using shared variables

    Hi
     My system has almost 200 I/O points,I want to the host communicates with PLC using OPC(I had create a OPC I/O Server).
    If I use shared variables bind to OPC data items, there must be almost 200 shared variables.
    And my puzzle is that what's the performance of using these shared variables,will they eat up memory and processor?
    Another question is that if an shared variable will be time-lapse(i.e.,if an OPC data item value change feedback to  program block with 0 delay or not),if so ,then how many millseconds it will delaies? 

    here is a paper about the performance of shared variables.
    Steve Bird
    Culverson Software - Elegant software that is a pleasure to use.
    Culverson.com
    Blog for (mostly LabVIEW) programmers: Tips And Tricks

  • How to use bind variables in this procedure

    Hi Experts,
    How to use bind variables in this procedure for static queries.
    PROCEDURE DELETE_MER_PROC (M_id IN NUMBER)
    IS
    BEGIN
    V_date DATE;
    SELECT PD_DATE INTO v_date FROM PD_MAINTAIN;
        DELETE FROM MER_CLEAR
        WHERE MER_DT < v_date
        AND ID = M_ID;
    COMMIT;
    END;   
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    Please help me.
    Thanks.

    976208 wrote:
    How to use  v_date and m_id as bind variables in this procedure to avoid hard parsing.
    You cannot avoid hard parsing - as the 1st time a SQL statement (like the SELECT or DELETE statements in your code) is encountered, it does not reside in the server's Shared Pool, and needs to be added into the pool via a hard parse.
    Bind variables does not prevent hard parsing. Hard parsing happens when the SQL statement (with or without bind variables) is a brand new statement encountered by the server.
    Bind variables enables the same SQL cursor to be reused, by simply changing the bind variable value.
    Not using bind variables means that each SQL statement is unique and not shareable - as the value is hardcoded into the statement and cannot be changed via a bind value. This typically means LOTS of different SQL statements (where the only difference is the changed value in the statement) are created - with each statement being a new statement not seen before in the Shared Pool and needing to be hard parsed.
    One does not design one's code not to be hard parsed. There ALWAYS will be a hard parse in order to get a SQL statement into the Shared Pool. One designs one's code to REUSE cursors in the Shared Pool.

  • Coercion problem when using Shared Variable

    I have a curious coercion problem when using Shared Variables.  I want to share the state of a State Machine, which is an enum saved as a control (typedef) called TYPE State (see attached).  I create a shared variable called State and define it as a Custom Control, using the just-mentioned typedef.  So far, so good.  I've attached three simple VIs -- the first one, Init State, simply wires a constant to the input of the Shared Variable to initialize it -- the wired constant is, of course, defined by the typedef.  However, the Get State and Set State, meant to wire an indicator (for reading the state) or control (for setting it), develop coercion dots when wired into the Shared Variable.  Why?  How do I get rid of the dot?  [I suppose I could abandon my typedef and custom control, but the beauty of typedefs and custom controls is that it "enforces" rules, lets you use enums for clarity, keeps the code "honest", etc. -- I'd hate to give that up just to get rid of a dot!].
    On a related note, the code seems to work.  This is much too simplistic to do anything, but if you open Set State and Get State, set the state to anything, run it (it immediately stops, of course), then run Get State, you'll see the chosen state appear in the indicator.  So it does appear to work.  The "error" (coercion dot) may, I suppose, be a "bug" in Labview because it can't figure out the mapping of the (very simple!) Custom Control, but if so, I hope it gets fixed quickly!
    Bob Schor
    Attachments:
    Coercion Problem1.zip ‏38 KB

    Hello Bob,
    I am also seeing this behavior, I will escalate this question to our LabVIEW developers and post again here no later than next Tuesday, November 27th as National Instruments will be closed for the remainder of this week.
    If this issue does turn into a product suggestion, I would suspect the workaround would to live with the coersion dot for the time being.
    Enjoy the holiday
    Regards,
    Erik J.
    Applications Engineer
    National Instruments

  • Use shared variables with FPGA device on Host PC

    Hi all I am having a frustrating problem. I am trying to use shared
    variables linked to a cRIO 9012. The shared variables were created and
    then written to in a RT vi. is there any way I can assign locations to
    these not within a RT vi. I altimately need to run the Host vi on a
    TPC-2512 touch panel computer and I can't run a RT application on that. I
    just need the variables to update without the RT vi running and I can't
    figure out how to do that, if its even possible. Here is what I have so
    far. Thank you in advance for your help.
    Attachments:
    PumpMonitoringDevice.zip ‏2083 KB

    Adam:
    You may be able to use arrays to speed up your program, but bear in mind that the TPC is pretty much guaranteed to be slower than your computer (as it's likely to have lower system specs).
    You'll want to use the array manipulation functions to combine and retrieve your data (most useful will likely be "Build Array" and "Index Array," see context/LabVIEW help for more details). Once you have the data in an array, you can likely pass it through a shared variable configured for an array datatype.
    I'm not sure if/how much of a speed boost it will give you, but I think it's definitely worth trying. If you're not sure about the speed, try simply cutting your variable count in half and see what kind of speed increase you get with the same amount of code but fewer variable values being transmitted through your network connection.
    Good luck!
    Caleb Harris
    National Instruments | Mechanical Engineer | http://www.ni.com/support

  • Communicating Between Multiple LabVIEW Executables on different computer using Shared Variables

    hi,
    I need to develop some executables which will be launched on different computer of a LAN. Some DATA are common. I need to share the data using shared variables.
    I usually used LabVIEW so I 'm familiar with shared variables but in this case, the RT target is a part of my
    project.
    I do I need to procceed in my case?
    thanks

    Ok but it's not my configuration and I haven't found my answer in the tutorial.
    You speak of a case where there is a computer and a RT target under the same LabView project. As I said earlier, I often use labview RT and shared variable between computer and RT target. But I assume here it's different.
    My question is : how do you acces to the SVE from 3 computers (without any RT target)? 
    1. If I create 3 labview projects using the same Shared Variable, do I need to use the same .lvlib on each project?
    2. Is it possible? 
    3. How can I configure where the SVE should be? When I use a RT target, It only depends where I put my Lvlib. But here there is 3 projects. 
    James
    Attachments:
    Sans titre.JPG ‏9 KB

  • How to use the variables used in the message mapping

    Hi ,
    In the message mapping we can declare variables in the JAVA section , these variables could be used across the mapping .
    I have tried using it but I am unable to retrieve the values assigned to the variables in one UDF into the another UDF .
    Please guide me how to use the variables declared in the JAVA section in the message mapping .
    Thanks
    Anita Yadav

    Anita,
    I have worked on the Global variables and i found no issues. Make sure that the variable is declared in the Declaration Section and then initlaized in the Initialization section.
    If you declare a variable in the Declaration Section ,
    int i;
    then in any udf you can use if directly. No need to re declare  the variable in the UDF. If you do this, then it becomes a local variable.
    Regards,
    Bhavesh

  • Using Shared Variables and Initialize Front Panel Binding (to PSP)

    Hi,
    I use LV DSC RT 8.2.1
    I have a Vacuum System That includes signals from - Pumps failure, Valves status, Vacuum gauge, start Pump ...
    Each signal is read by a FieldPoint. 
    All the relevant FieldPoint Channels are read by the Server (a computer in the Ethernet Network) and published to the network in the form of Shared Variables.
    I have a client VI that is reading the Shared Variables published by the Server using Front Panel Binding.
    Problem : 
    Some of the Bindings are in the mode 'Write &Read' and that causes some initialization problems.
    For example - Valve #1 is Open, and then a User start running the Client VI, (the Valve #1 Status mode is 'Write & Read")
                           if in the VI the status of Valve #1 is closed (before running it) then the Valve status is changing to Closed.
    I want the Client VI to first read the Physical status of the instrument and then to change the Value if the User changes it.
    But that's seems to be a problem when using Front Panel Binding... (is it?)
    I know I can Deploy a lvlib in the Client Side and Item Bind to the Shared Variables or Use DataSocket.
    (Is DataSocket is a Reliable method when connecting to Shared Variables? What are the disadvantages when using DataSocket?) 
    What is recommended by those of you that are experienced or by NI ?
    Sincerely Yours,
    Amitai Abramson.

    Amitai Abramson,
    Hello and thanks for using the NI Forums.
    I'm glad that you've read the Using the LabVIEW Shared Variable Tutorial on our website. Check out these other resources:
    Network Variable Technical Overview
    Troubleshooting Network-Published Shared Variables
    Why Do I See Unexpected Value Change Events for Shared Variables Using LabVIEW DSC?
    All You Need to Know About Shared Variables
    Creating a Value Change Event for Shared Variables
    Alternative Method for Using Shared Variables Between Systems in LabVIEW 8.x
    What Is The Difference Between Using Shared Variables And DataSocket VIs To Access OPC Tags?
    The issue that you are seeing by having "Write & Read" bound items on both the server and client side is essentially a race condition, you don't know which one is being read/written at what time. To resolve this issue I would take a look at some of the documents below.
    Using a Local, Global, or Shared Variable in Parallel Loops Can Cause Race Conditions
    Using Local and Global Variables Carefully
    Tutorial: Local Variable, Global Variable, and Race Conditions
    Locking a Shared Resource or Variable in LabVIEW Using Semaphores
    You mentioned not wanting to have two sets of shared variables (one on each side), but this is a great method to resovle this issue, that, or you can develope some sort of hand shaking to prevent these race conditions.
    I would suggest that in the future when using these forums you try to ask only one question per thread and make it more concise. It's hard to tackle multiple questions and such broad questions as "I want to know all the ways that I can connect to Shared Variables, and I want to know the advantages and disadvantages." I suggest this because we want you to get your questions answered and more concise questions will result in quicker and better answers. 
    Message Edited by Ben S on 10-01-2009 06:05 PM
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • How  can use a variable in the folowing code?

    How  can use a variable 'W_ROWNUM2' in the folowing code?
    MOVE '1' TO CNT.
    LOOP AT L_T_PM2.
                  CONCATENATE '0' CNT INTO W_ROWNUM2.CONDENSE W_ROWNUM2.
                   CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
        perform  DYNPRO_FIELD       using FLD2
                                     L_T_PM2-vari12_con.
                   CNT = CNT + 1.
                   CONDENSE CNT.                                                              
    ENDLOOP.
    I need to increment the value of W_ROWNUM2.
    Please ,it is urgent!!

    Hello
    CONCATENATE 'F110V-VARI'W_ROWNUM2'(01)' INTO FLD2.
    Try using spaces between parts of the resulting string.
    CONCATENATE 'F110V-VARI'  W_ROWNUM2  '(01)'   INTO FLD2
    Regards
    Greg Kern.

  • How to use bind variables in the following query

    CREATE OR REPLACE PROCEDURE MMDB.test IS
    sel_qtn VARCHAR2 (10);
    CURSOR PT_QUANTITY IS select * from mmdb.product_tree WHERE QUANTITY_CHECK ='E'
    AND run_id = 100
    a PT_QUANTITY%ROWTYPE;
    BEGIN
    FOR i IN PT_QUANTITY
    loop
    sel_qtn := i.quanttity-1;
    While sel_qtn>=1
    loop
    insert into mmdb.product_tree (BILLING_ACCOUNT_NO ,S_CODE) values (i.BILLING_ACCOUNT_NO ,i.S_CODE||'E');
    sel_qtn :=sel_qtn -1;
    End loop;
    commit;
    end;

    Don't duplicate threads: How to use bind variables in the following query

  • How to use Bind Variables in Essbase data control

    Hi,
    I am trying to use Bind Variables in MDX query while creating the Essbase Data Control. I have used the below query with the Bind Variable.. this query is working in Essbase admin console..but it is throwing error (*Invalid MDX Query)* while creating Essbase Datacontrol in JDeveloper.
    MDX Query : SELECT {[Measures].Msr_2} ON COLUMNS, [Time].Children ON ROWS FROM cube
    where ($name)
    Could any body suggest me on how to use bind variables with Essbase Data control.
    Thanks,
    Swathi

    Hello Swathi, can you please help me how you created Essbase DataControl? Also were you able to figure out this?
    Thanks, Praveen.

Maybe you are looking for

  • FTP problem: connection going idle or missing; takes a minute to refresh

    Hi, i hope i explain myself, please forgive me my lack of tech-language and if i'm redundant: In my office we got a G5 dual that we turn into a server (Mac OS Server 10.5.7) for a couple of websites (for external use). I need this guys to have FTP ac

  • Ios 7 taking too much time too download

    why ios 7 is taking so long to download> any one downloaded succesfully?

  • Material PO text not copying to Purchase Requisition

    Any assistance would be gratly appreciated... When creating a Purchase Requisition (ME51N) text from the Material Master - Material PO Text automatically copies to the Material PO Text of the Purchase Requisition line item - as expected However, when

  • Which component I should choose to simulated a stepper motor's winding?

    Dear all, I'm now trying to design a chopper type stepper motor driver. In order to learn from basic, I build a simple circle with only one motor winding. I choose advanced inductor for motor winding. But some of the parameters required in this compo

  • Nokia e5-00 Dropped in water

    hey i dropped my phone in water and then i dried it with a blow dryer put it in rice blah blah blah. then it turned on a seems to work fine except when i use the keypad only the number symbol comes up or a square. like no numbers or letters come up.