Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Links - Developer Zone

Accessing Lookout Driver Object Data Members

26 ratings | 3.65 out of 5
Print
This document will guide you through an example for accessing and modifying PLC object data members in Lookout. This example was created using Lookout 4.0.1 and an Allen Bradley SLC500 5/04 PLC, however, the techniques discussed here should be applicable to most, if not all, PLC's.

Assume that you have successfully configured your PLC in Lookout. Before we start accessing any data members, we need to know the various data members available for the object. Refer to the Lookout Help for information about a specific object data members. Below is a list of object data members for the AB_SLC500 object, copied directly from the Lookout Help.

In this example, we are going to access and modify registers O:0_4, N:0_3 and B:2; two discrete and a 16-bit registers respectively. However, if you look at the AB_SLC500 object data members in Object Explorer, you would notice that the data members are listed in groups, like B:0-B255:255 and I:0-I:60. You can only access any data members within those groups, for example register O:0_4 is a data member within O:0_0-O:60_15 group, but you cannot access register O:60_20 since it is beyond the O:0_0-O:60_15 group as well as any other group in Object Explorer, therefore it does not exist.
There are three ways to create an expression for a data member:

    i. The easiest way to create an indicator for a data member is to left-click the data member group in the Object Explorer and drag it onto the control panel.
    Since register O:0_4 is a member of O:0_0-O:60_15 group, left-click and drag and drop O:0_0-O:60_15 from the Object Explorer to the control panel.
    By default, Lookout will create a display for register O:0_0 using its default display type. The default display type for a one-bit register is LED. Since we want to access register O:0_4 instead of O:0_0, we need to change the display's object properties. That procedure is discussed later on.

    ii. When creating a display for a data member, if you want to be able to choose a different type of display, right-click the data member group in Object Explorer then drag and drop it onto the control panel. An option dialog will pop-up showing the different choices of display available.
    As an exercise, we are going to create a display for N:0_3, which is in the N:0_0-N255:255_15 group.
    Right-click N:0_0-N255:255_15 in the Object Explorer and drag and drop it onto the control panel.
    As soon as you drop it on the control panel, an option dialog appears showing the different choices of display available. In this example, we are using the default display type.


    Again, by default, Lookout will create a display for register N:0_0, therefore we need to change the display to N:0_3 which will be discussed in later on in this document.

    iii. Another way to create a display for a data member is by using the Insert Expression dialog box. There are three ways to bring up the Insert Expression dialog box.
        Right-click anywhere on the control panel and select Insert Expression


        Or select Insert>>Expression


    or press <Ctrl-E>.
    These three methods open the Insert Expression dialog box.

    Now we are going to create an expression for register B:2. On the left side of the dialog box, there is a box where you can explorer your computer and local network. Browse your computer, locate and select the AB_SLC500 object.


    On the right side of the dialog box, you can see the contents or data members of the object. Since we want to access B:2, select B:0-B255:255 group. Notice that next to the Paste button, you see the expression Object_name.B:0. Click Paste and the expression will be pasted to the yellow textbox at the top.


    Change the value of the expression on the yellow textbox from Object_name.B:0 into Object_name.B:2, since B:2 is the data member that we want to have access to. You can even change the display type for the data member. Click OK when you are done.


    Next you need to set the display properties. Accept the default settings and click OK.

    Now, the control panel display should be similar to the image below.

Now we need to make changes to some of the expression so they point to the data members that we want.
Right-click the display for the O:0_0 and N:0_0 data members, and select Object Properties.


The Revise Expression dialog box appears. Make sure the correct expression is in the expression box (the yellow field). The expression should be in the form of Object_name.datamember, for example AB1.O:0_4 and AB1.N:0_3 for O:0_4 and N:0_3 respectively.
Change the expressions O:0_0 and N:0_0 into O:0_4 and N:0_3, since these are the registers that we want to access.


There are two ways to create control objects for the registers.
    i. First we are going to create a switch control for register O:0_4 using remote connection. The easiest way is to right-click and drag and drop O:0_0-O:60_15 from the Object Explorer onto the control panel. When the option dialog appears, select Create Control>>Switch.


    The New Switch dialog box appears. Make sure that the Position source is set to Remote and the URL points to the data member that you want to connect to in the form Object_name.datamember, in this example AB1:O:0_4. Click OK when you are done.


    Then choose the type of switch that you want to use.


    As an exercise, create another switch for register N:0_3 using this method. The final look of the control panel for this step should be similar to the image below.


    ii. Another to connect a control object is with a direct connection. Now we are going to create a control Pot for B:2 register using direct connection.
    First create a new Pot object. Accept the default settings and click OK.

    Now we are going to create a connection from the new pot to the B:2 register. Remember to edit connection of the object to which you are connecting. Since we are connecting from a Pot to a data member, edit the data member connection, not the Pot connection. Right-click the AB_SLC500 object in the Object Explorer and select Edit Connections to open the edit connection dialog box.


    First we need to specify which data member that we want to connect to in Writable members section, in this case B:2. Make sure B:2 is in the box next to the Select button. Click Select.


    Select Pot1 and click Paste. Pot1 should be pasted onto the yellow expression box.


    Click Accept. Make sure you see the connection in the Existing Connections box. Then click Quit after you are done.


    Left-click and drag and drop Pot1 object from the Object Explorer onto the control panel to create a display for the Pot.
    Select the knob control type and click OK.

The final look for the process should be similar to the image below. Now you can use the switches and Pot to change the value of the registers.



26 ratings | 3.65 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).