RSLogixAutomation InterfaceReference ManualJune-2002
Contacting Technical Support Telephone—1-440-646-5800Rockwell Software Technical Support Fax—1-440-646-5801World Wide Web—www.software.rockwell.comCopyright Notice 2001, 2002 Rockwell Software Inc., a Rockwell Automation company. All rights reservedPrinted in the United States of AmericaPortions copyrighted by Allen-Bradley Company, LLC, a Rockwell Automation company.This manual and any accompanying Rockwell Software products are copyrighted by RockwellSoftware Inc. Any reproduction and/or distribution without prior written consent from RockwellSoftware Inc. is strictly prohibited. Please refer to the license agreement for details.Trademark Notices The Rockwell Software logo, RSLogix 5, RSLogix 500, RSView32, RSView, and SoftLogix 5 aretrademarks of Rockwell Software Inc., a Rockwell Automation company.DH , MicroLogix, PLC, PLC-2, PLC-5, PLC-5/250, SLC, and SLC 500 are trademarks of theAllen-Bradley Company, LLC, a Rockwell Automation company.Microsoft, and Visual Basic are registered trademarks of the Microsoft Corporation.ControlNet is a trademark of ControlNet International.All other trademarks are the property of their respective holders and are hereby acknowledged.Warranty This Rockwell Software product is warranted in accord with the product license. The product'sperformance will be affected by system configuration, the application being performed, operatorcontrol and other related factors.The product's implementation may vary among users.This manual is as up-to-date as possible at the time of printing; however, the accompanyingsoftware may have changed since that time. Rockwell Software reserves the right to change anyinformation contained in this manual or the software at anytime without prior notice.The instructions in this manual do not claim to cover all the details or variations in the equipment,procedure, or process described, nor to provide directions for meeting every possible contingencyduring installation, operation, or maintenance.
ContentsChapter 1Introduction to the automation interface . 1What is VBA and what does it do? .1Advantages . 1Uses . 2Finding your way around this book .3Automating the ladder logic editor. 3Automating the documentation database editor . 4Supplemental information .5Example files.5How to access VBA in RSLogix 5 and RSLogix 500 .6Create your VBA code .6Some quick programming tips .6Chapter 2Application object . 9Properties .10Methods .13Events .18Summary example .22Form. 22Code . 23Chapter 3LogixProject object . 25Properties .26Methods .28Events .36Summary example .41Form. 41Table of Contents i
Code . 41Chapter 4Processor object .45Properties . 46Methods . 49Events. 51Summary example. 51Form. 52Code . 53Chapter 5ProgramFiles collection .57Properties . 57Methods . 58Events. 60Summary example. 60Form. 61Chapter 6ProgramFile object.65Properties . 66Methods . 68Events. 68Summary example. 68Form. 69Code . 70Chapter 7DataFiles collection .75Properties . 75Methods . 76Events. 79Summary Example . 79Form. 80ii RSLogix Automation Interface Reference Manual
Code . 81Chapter 8DataFile object . 85Properties .86Methods .88Events .88Summary Example .89Form. 90Code . 90Chapter 9LadderFile object. 95Properties .96Methods .98Events .101Summary example .101Form.102Code .103Chapter 10Rung object. 109Properties .110Methods .112Events .112Summary example .112Form.113Code .114Chapter 11RevisionNotes object . 119Properties .120Methods .120Events .121Summary example .121Table of Contents iii
Form. 122Code . 122Chapter 12ReportOptions object .127Properties . 128Methods . 132Events. 132Summary example. 133Form. 133Code . 133Chapter 13AddrSymRecords collection .137Properties . 138Methods . 138Events. 144Chapter 14AddrSymRecord object .145Properties . 146Methods . 147Events. 152Chapter 15RungCmntPageTitleRecords collection .153Properties . 154Methods . 154Events. 164Chapter 16RungCmntPageTitleRecord object .165Properties . 166Methods . 167Events. 169iv RSLogix Automation Interface Reference Manual
Chapter 17PasswordPrivilegeConfig object . 171Properties .172Methods .172Events .189Appendix AObject model diagrams . 191Introduction .191RSLogix 5 object model summary.192RSLogix 500 object model summary .195RSLogix 500 object model summary, database utilities .197Appendix BType definitions and constants. 199RSLogix 5 and RSLogix 500 type definitions and constants.199lgxDataFileTypeConstants (RSLogix 5) .200lgxDataFileTypeConstants (RSLogix 500) .201lgxKeyPositionConstants (RSLogix 5 and 500) .202lgxOnlineAction (RSLogix 5 and 500).202lgxProcessorTypeConstants (RSLogix 5) .203lgxProcessorTypeConstants (RSLogix 500).204lgxProcOnlineState (RSLogix 5) .205lgxProcOnlineState (RSLogix 500).205lgxProgramFileTypeConstants (RSLogix 5).206lgxProgramFileTypeConstants (RSLogix 500) .206lgxRungZoneTypes (RSLogix 5 and 500) .206lgxSaveAction (RSLogix 5 and 500).206lgxUpDownloadAction (RSLogix 5 and 500).207lgxWindowStateConstants (RSLogix 5 and 500).207lgxImportDBTypes (RSLogix 5 and 500) .207lgxBinary (RSLogix 5).207lgxChannel (RSLogix 5) .207lgxPrivilege (RSLogix 5).208Table of Contents v
lgxPrivilegeType (RSLogix 5) . 208lgxErrorTypes (RSLogix 5 and 500) . 209Appendix CHandling errors.211Appendix DGeneral differences in the RSLogix 5 and 500 automationinterfaces .215PasswordPrivilegeConfig . 216DataFile object . 216ProgramFile object. 216ReportOptions object.216LogixProject object. 216Processor object . 217Ladder object . 217Index .219vi RSLogix Automation Interface Reference Manual
ChapterIntroduction to theautomation interfaceWhat is VBA and what does it do?Visual Basic for Applications (VBA) is the edition of Visual Basic designedspecifically to provide rich development capabilities in an off-the-shelfapplication. Microsoft licenses VBA to application vendors such as RockwellSoftware, who integrate it into their products. This makes the familiar VisualBasic development environment readily available for users to adopt, rapidlyextending their host application and integrating it with other VBA enabledapplications. In this sense, VBA is a “glue” or bridge between ComponentObject Model (COM)-enabled software packages that allows them toefficiently inter-operate with each other.AdvantagesSince VBA contains a full Visual Basic implementation, including a projectspace, full language syntax, debugging, the forms package with ActiveXControls, and an Object browser, it can save you money over purchasing aseparate stand-alone copy of VB.Solutions created with VBA execute quickly, since they run in the samememory space as the host application and are tightly integrated with it. Suchquick execution allows developers to write code that responds to user actions,such as opening, closing, or saving projects, or reaching database informationthrough code.If you use products with embedded VBA the programming environment,including language, interface, and so on, is truly standard no matter which ofthe VBA licensed applications are involved. For example, the standard applieswhether you use Rockwell Software’s RSLogix 5 , RSLogix 500 , orRSView32 or even Microsoft Excel or Word.Introduction to the automation interface 1
Object models also mean a more open environment. If there are many vendorsproducing VBA-enabled applications, the walls of proprietary technologybarriers start to break down. Therefore, developers building multipleapplication software solutions can concentrate more on the functionality of theapplication, instead of wasting time and resources trying to get the differentvendors packages to communicate or share data.The VBA environment, shown below in the RSLogix5 software product, is thesame everywhere it appears.UsesVBA uses the objects, methods, properties and events of the RSLogixautomation interface to enable you to author scripts to automate tasks within theRSLogix editor. You can automate many of the routine, repetitive tasksinvolved in setting up RSLogix projects and customize your application. Forexample using the RSLogix object model you can automate functionality fromwithin the Ladder Logic editor. Some uses might include: generating RSLogix ladder logic template files from code librariesautomating your project creation tasks building individualized interfaces that execute functionality within RSLogixgeared to specific groups within the factory environment, essentially“wrapping” subsets of functionality in your own interfacegenerating event-driven HTML reports2 RSLogix Automation Interface Reference Manual
connecting your project to a web server so that it can be viewed over theinternettying applications together so developers can share application data andfunctionality within a common environmentFinding your way around this bookYou’ll see that the chapters in this book are organized by objects, starting withthose basic to general file creation and ladder logic editing. Read the tables thatfollow for a chapter-by-chapter summary of the information in this book.Automating the ladder logic editorThe following objects represent those functional areas that relate to filecreation and manipulation and to the graphical ladder logic that defines yourcontrol program.Objects:Purpose:Chpt:ApplicationThe Application object represents theRSLogix application. Use it to get otherobjects and perform top-level operations.(Make sure to read the importantprogramming advice on Page 10 when usingthe Application object from within VBA.)2LogixProjectThe LogixProject object represents theRSLogix project. Use it to access, define andreturn various attributes of an existingRSLogix project.3ProcessorThe Processor object represents the PLC,SoftLogix, SLC or MicroLogix processor.Use it to automate online functionality suchas enabling and disabling forces, changingproperties or handling edits.4ProgramFilesThe ProgramFiles collection represents allthe program files in the project. Use it to addor remove program files from a collection.5ProgramFileThe ProgramFile object represents basefunctionality of a program file. Use it toreturn file characteristics such as online andprotection status or use it to name the file.6Introduction to the automation interface 3
Objects:Purpose:Chpt:DataFilesThe DataFiles collection represents all thedata files in the project. Use it to add orremove data files from a collection or readraw data.7DataFileThe DataFile object represents a data file inthe project or processor. Use it to returndefined attributes of the file.8LadderFileThe LadderFile object represents a ladder filein the project/processor. Use it to learn afile’s attributes or manipulate rungs in theladder file.9RungThe Rung object represents a rung of ladderlogic. Use it to obtain information about therung.10RevisionNotesThe RevisionNotes object contains therevision notes for the project. Use it to get anindexed revision note or return the numberof notes recorded for the project.11ReportOptionsThe ReportOptions object represents thereport settings associated with the project.Use it to read, establish or change settings.12PasswordPrivilegeConfigThe PasswordPrivilegeConfig objectrepresents the master and class privilegeadministration unique to RSLogix5.17Automating the documentation database editorRSLogix 5 and RSLogix 500 (Professional) versions 5.50 and later provide fulldatabase functionality with the following objects and The AddrSymRecords collectionrepresents all records in the address/symbol editor list. Use it to add orremove entries from the collection orread raw data.13AddrSymRecordThe AddrSymRecord object representsdata in the address/symbol editor list.Use it to return or set a value in anyfield.144 RSLogix Automation Interface Reference Manual
e RungCmntPageTitleRecordscollection represents all records in therung comment/page title editor list.Use it to add or remove entries fromthe collection or read raw data.15RungCmntPageTitleRecordThe RungCmntPageTitleRecord objectrepresents data in the rung comment/page title editor list. Use it to return orset a value in any field.16Supplemental informationThe appendices in this book provide this additional information.Title:Purpose:Appendixx:Object Model DiagramsView complete object model diagramsfor RSLogix 5 and RSLogix 500.AValid Type DefinitionsDescriptive lists detailing how toconstruct valid terms of a type. Separatelists are included for RSLogix 5 andRSLogix 500.BHandling ErrorsA discussion and brief example of howto programmatically handle exceptionsthrown by RSLogix.CGeneral Differences in theRSLogix 5 and 500Automation InterfacesSummary table of the differences in theobject models of RSLogix 5 and RSLogix500DExample filesMost chapters in this book include an example to help you understand how touse the object model. Although written for the RSLogix 5 software product,they may be easily adapted to RSLogix 500. For example type definitions mayvary between products, and those differences must be considered whenadapting code to the RSLogix 500 object model.To assist you as you write your code, some samples are included on yourRSLogix product compact disk. Look for the VBA samples (.rsp project) onthe product CD to access these examples electronically.Introduction to the automation interface 5
How to access VBA in RSLogix 5 and RSLogix 500To access VBA from within an RSLogix application follow these simple steps:1. Open the project in your RSLogix software to which you want to attachyour Visual Basic code.2.Press [Alt] [F11] to open the Microsoft Visual Basic project window.3.Press [F2] to call the Object Browser. Make sure that the respectiveRSLogix5 or RSLogix500 type library is listed in the type library index.4.The Project Explorer window (pictured in the left pane in the illustrationon Page 2) displays forms, modules (files that hold the supporting codefor the application), classes (advanced modules), and more. When youwant to work with a particular part of the loaded application, double-clickthe component in the Project Explorer window to bring that componentinto focus.Create your VBA codeUsing the Visual Basic programming language, create subroutines in the codewindow for the project. Create subroutines that work with the RSLogix 5 orRSLogix 500 objects.VBA subroutines run on a first-in, first-out basis. Each subroutine runs tocompletion
RSLogix 5 and RSLogix 500 (Professional) versions 5.50 and later provide full database functionality with the following objects and collections. DataFiles The DataFiles collection represents all the data files in the project. Use
3 Emonitor Version 3.5 RSLogix 5000 Interface Guide for XM modules Sample project file There is a sample project file that shows how the information in this guide can be used in an RSLogix 5000 project. The project is located on the Emonitor version 3.50 software installation disk: \extras\RSLogix Application\ICM DATA APP.ACD
ii Q Getting Results with RSLogix 500 Training Rockwell Software offers both classroom training and a computer-based training program for RSLogix 500 software. For more information see RSLogix 500 Training on page 77. Commonly used terms The following table defines terms commonly used in this book. This term: Represents this concept:
navigate the RSLogix 5 software.This guide includes troubleshooting information and tips on how to use RSLogix 5 effectively. It also explains how to access and navigate the online help. We assume that you are a control engineer familiar with:Intended audience IBM -compliant personal computers Microsoft Windows operating systems
With RSLogix 5000, you need only one software package for discrete, process, batch, motion, safety and drive-based . applications. RSLogix 5000 offers an easy-to-use, IEC61131-3 compliant interface, symbolic programming with structures and arrays and a comprehensive instruction set that serves many types of applications.
Application Techniques, publication IA-AT003 A manual on how to configure CIP Sync with Intergrated Architecture products. and applications. Getting Results with RSLogix 5000, publication 9399-RLD300GR Information on how to install and navigate RSLogix 5000. The guide includes troubleshooting information and tips on how to use RSLogix 5000 .
the PLCs. Admittedly, the software is a bit pricey, but in my opinion, it is worth it. Getting The RSLogix 5000 Software If you don’t have access to a PLC, it would be well worth the effort to download the demo version of RSLogix 5000. The demo runs for 90 days, and has some limitations, but you will be gaining experience with the real thing.
drill press, while explaining all the basic concepts of PLC programming that are necessary to . and I/O modules are all programmed using Rockwell’s proprietary software known as RSLogix (RSLogix 500 is the software used to program the SLC family of PLCs, while RSLogix 5000 is
influence of ideological values on the policies and practices of America’s criminal justice systems. Recently, however, a trend toward critical analysis of the behavior of police, courts, and corrections has emerged that focuses exclusively on ideology as the analytical tool of choice. For example, Barlow (2000), and Bohm and Haley (2001) include extensive discussion of the influence of .