SWTB_Banner_Left_LogoOnly

Using Symbol Factory.NET with
INGEAR.NET PLC Driver Components

clearpixelclearpixel

SWTB_7Button_BlueLine

Using Symbol Factory .NET with INGEAR.NET Components

The INGEAR.NET family of PLC direct connect components makes the task of tying your Symbol Factory .NET to tags on your PLC an easy and painless process. In five quick and easy steps, we'll show you how to poll a MicroLogix 1500 tag and update the graphics if the value changes.

Prerequisites:

This example assumes that you have an one of the INGEAR.NET family of products installed. Since we will be connecting to a MicroLogix 1500, we will use the INGEAR.NET.ABLink.

Step 1

Drop your Symbol Factory .NET components on your form. In this example, we will use the default pump (Standard Control) and the default Cutaway Control.

SF_Dropped_On_Form

Also drop a .NET Timer on your form. Just keep the name Timer1 for this example.

Timer1_In_Toolbox

Step 2

Next, add the references to your INGEAR.NET product to your solution by right-clicking on your solution.

First, right-click on your solution and select "Add Reference".

Add Reference Solution

Second, find the INGEAR components you need, select them, and click OK. There will be two references added - the INGEAR product itself and the INGEAR interface. In this example, because we will be connecting to a MicroLogix 1500, we will use the INGEAR.NET.ABLink component.

Add Reference Dialog

Your solution will now look like this:

INGEAR_In_Solution

Step 3

Next, add some animations to your Symbol Factory .NET Standard Control, in this case the Pump. To do this, right click on the component and select "Symbol Factory .NET Properties".

Select_SF_Properties

Then, click on the "Animations" tab, and select "AnalogColor Fill" from the AnimationMode pull down menu. From here, you can select any animation sequence you wish. We've chosen five animation bands for this example.

Symbol_Property_Page

For a more detailed explanation on how animations work, see "Using Bands" in either the Visual Studio 2003 or Visual Studio 2005/2008 sections of this web site.

Step 4

Now we tie in the PLC to the symbols. To do this, we simply declare an instance of the PLC (called "Controller") and the tag itself (called Tag) within INGEAR.NET.ABLink. For this example, the instances have been declared globally in the Form1 class To declare the items globally, you will need to place the following code after the class declaration but outside of any subroutines or functions you declare:

 Public Class Form1
  
'
  
' Define global parameters here
  
'
  Dim PLC As ABLink.Controller
  Dim PLCTag As ABLink.Tag
  
'
  
' the rest of your code (subroutines, functions, other
  ' global variables) goes after this and before the End Class

  
'
 End Class

Then initialize the timer and the PLC instances. For this example, this was done in the Form_Load event:

   Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    '
    ' Initialize our INGEAR.NET.ABLink components,
    '  our Timer, and start the polling
    '
    PLC = New ABLink.Controller( _
      "64.132.42.22", _
      ABLink.Controller.CPU.MLC, _
      ABLink.Controller.Driver.NETENI)
    PLCTag = New ABLink.Tag("N7:0")

    '
    ' We want to scan the tag four times a second, or 250ms
    '
    Timer1.Interval = 250
    Timer1.Enabled = True
    '
    ' Any other Form_Load code you need goes after this.
    '
 

And finally setup the logic in the TimerTick event to handle the reading of the tag and updating the symbols:

   Private Sub Timer1_Tick(ByVal sender As System.Object, _
    ByVal e As System.EventArgs)

    '
    ' Here, when the timer has ticked, we want to read the
    '  value of PLCTag from the PLC
    '
    Dim theValue As Integer
    PLC.ReadTag(PLCTag)
    '
    ' Check to see if the value returned by the PLC has changed,
    '  and if it has, set the values accordingly
    '
    theValue = CInt(PLCTag.Value)
    If theValue <> CutawayControl1.Level Then
      CutawayControl1.Level = theValue
      StandardControl1.AnalogValue1 = theValue
    End If
    '
    ' Any other Tiemr1_Tick code you need goes after this.
    '
 

Of course, no error checking has been done on this routine - you will need to add your own error checking in order to make this routine bullet-proof.

For more information on how to use the INGEAR.NET components, see our INGEAR.NET site.

Step 5

Run and you're done!

Links of Interest

If you wish to learn more about the components used in this example, please see the following:

 

 

 | HOME | PRODUCT DETAILS | HOW TO USE WITH | FREE DEMO | ORDERING | CONTACT US

P: 1-888-665-3678 (US-Sales) or 704-849-2773 (Support & International), F: 704-849-6388
148A East Charles Street, Matthews, North Carolina, USA 28105
Copyright Software Toolbox, Inc., 1996-2007, All Rights Reserved Worldwide.