Professional Documents
Culture Documents
John Weber
The Software Toolbox ®
jweber@softwaretoolbox.com
Copyright 1998 Qualitrol International & Software Toolbox.All rights reserved worldwide.The Software Toolbox is a registered trademark of Qualitrol International.
Why are we here today ?
Interfaces
Power
Supply PLC Rack
Object Terminology
Properties - number of channels, voltage level, scaling set points, channel type
Methods - send analog input to CPU, scale value
Events - voltage changed on field input side, scaling updated, updated value sent
to CPU, configuration change received from CPU
Object Terminology
A simple software
object - a text box
on a VB form
Command
Button
Object
Command
Button
Properties
Everything on your
Excel spreadsheet is an
object! - the worksheet
is a collection of cell
objects, a workbook is
a collection of Cell Cell
worksheet objects Properties Object
Software Objects Examples
Invoking the
Print Method
ActiveX control
objects “plug-in” to
VB to let you add
functionality
• PLC Communications
• Trends
• Gauges
• Tanks
Adding an ActiveX Component to
the VB Toolbar & To A Form
Right Mouse
Click with
pointer over
the toolbar
and select
“components”
The Default
VB Toolbar
Events
Properties
Methods
VB - The Glue to connect
objects in your container
• VB - Visual Basic - a full fledged
development environment
• VBA - Visual Basic for Applications
– It is macro language in the Office applications
– Is licensed by over 100 companies for use as their
scripting language for customization
• Both Use simple object.property,
object.method, object_event syntaxes
• VB known by 3,000,000 people worldwide
Assembling the Objects in a
Container
Simple Visual Basic Syntax for referring to objects
Properties - ObjectName.Property = variable or value
Methods - Objectname.Methodname (parameters)
Events - Private Sub Objectname_EventName( )
user Logic
End Sub
Example Statements displays text in a text box by setting the
Text1.Text = “Hello World” .Text property on the Text1 text box object
Add an instance of
a dynamic gauge
ActiveX plug in to
your VB toolbar
and then to your
form
• Uses same
controls and
adds one new
• Uses new
methods and
events on PLC
ActiveX VB List Box Control PLC ActiveX
control to for simple alarm VB Data Control Communications
display - new to this for Database
provide alarm project Connectivity
Control
generation
capability
Alarming and Logging
Generating the Alarms
• Watchpoint Methods
– Method included in PLC ActiveX control
– User specifies high, low limits and type of alarms
desired (on high, on low, on change, on normal, on
discrete change)
– Autopoll method used to tell control how often to
check the points
• Could all be done with VB If-then structures
• Using the ActiveX controls’ methods instead
saves code and troubleshooting time
Alarming and Logging
Client PCs running your VB HMI Application and using a PLC ActiveX
control that supports direct Ethernet connections to the PLC
• Provides a solution when the investment to replace PLCs with Ethernet Based CPUs is too high or the
PLC network interface cards for each client are cost-prohibitive
• The gateway software bridge can be either an EXE program that is included with some PLC
communications ActiveX controls or an OPC server
Transfer Line Application
Transfer Line Application
Microbrewery Application
Benefits of Using Visual Basic
for HMI Applications
• Use the right tool for the right job
– Simple to moderately complex apps
– Don’t reinvent a pre-configured HMI in VB if that’s
really what you need
• Support for wide range of ActiveX plug-ins
• Widely known scripting language
• Flexibility - you control the application
• Cost
– you can distribute your VB code royalty free
– ActiveX components have low or no royalty fees for
Resources for further learning
www.softwaretoolbox.com