GE Universal Remote GFK 0804B User Manual

GEFanuc Automation  
Programmable Control Products  
GEFanuc  
Micro PLC  
Programmer’s Guide  
GFK-0804B  
April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Preface  
This book is the reference guide to programming the GE Fanuc Micro PLC.  
Content of this Manual  
Chapter 1. Programming for the Micro PLC: describes programming basics, the Micro  
PLC instruction set, programming devices and formats, memory types and addresses,  
constants and register values in a program, and special coils.  
Chapter 2. Programming with the Programming Software: explains how to create and  
edit programs using the programming software.  
Chapter 3. Programming with a Hand-held Programmer: explains how to create and  
edit programs using a Hand-held Programmer.  
Chapter 4. The Micro PLC Instruction Set: explains in detail the instructions that can be  
incorporated into an application program for the Micro PLC.  
Appendix A. Using Directories: gives advice on organizing the Micro PLC directory structure  
on your hard disk.  
Appendix B. Micro PLC Protocol: the information in this appendix is for advanced users  
only. It explains programming to set up communications between the Micro PLC and a  
host system.  
Appendix C. RTU Protocol: describes the Remote Terminal Unit (RTU) serial  
communications protocol, which can be used to provide communications between the  
Micro PLC or other remote device and a host computer.  
Appendix D. Communications Using Windows DDE: describes an available software  
product that can be used to connect DDE-compliant Microsoft Windows programs  
with data in a Micro PLC.  
Appendix E. Data Acquisition, Logging, and Display Program: describes the Data  
Acquisition, Logging, and Display Program software, which is provided on the Micro  
PLC software diskettes.  
Appendix F. Programming Applications: describes simple programming for: a flip-flop,  
a powerup one-shot, cascading counters, and an industrial “starting circuit”.  
Related Publications  
GE Fanuc Micro PLC Users Guide (GFK-0803): contains product specifications,  
installation instructions, and general information needed to set up and use a Micro PLC.  
GE Fanuc Micro PLC Self-Teach Manual (GFK–0811): a quick-start guide to  
understanding and using the Micro PLC.  
GFK-0804  
iii  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Preface  
Technical Assistance  
If you should have a problem installing or programming your GE Fanuc Micro PLC, and the  
information you need is not in this book or the Micro PLC Users Guide, you can call GE  
Fanuc Field Service at 1-800-828-5747.  
We Welcome Your Comments and Suggestions  
At GE Fanuc automation, we strive to produce quality technical documentation. After  
you have used this manual, please take a few moments to complete and return the  
Reader s Comment Card located on the next page.  
JeanneL. Grimsby  
Senior Technical Writer  
GFK–0804B  
iv  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Contents  
Chapter 1  
Programming for the Micro PLC . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
1-1  
Programming Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
PLC Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
The Micro PLC Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Programming Devices and Formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Memory Types and Addresses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Constants and Register Values in a Program . . . . . . . . . . . . . . . . . . . . . . . .  
Special Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Programming for an Analog Expander Unit . . . . . . . . . . . . . . . . . . . . . . . .  
1-2  
1-3  
1-4  
1-5  
1-6  
1-6  
1-7  
1-8  
Chapter 2  
Programming with the ProgrammingSoftware . . . . . . . . . . . . . . . .  
2-1  
Using the Programming Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Creating a Program Rung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Running the Programming Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Editing Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Horizontal and Vertical Lines in a Rung . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Element Labels and Rung Labels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Editing a Completed Rung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Deleting Rungs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Moving Rungs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Copying Rungs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Searching for a Rung or Program Element . . . . . . . . . . . . . . . . . . . . . . . . .  
2-2  
2-4  
2-5  
2-6  
2-7  
2-8  
2-9  
2-13  
2-13  
2-14  
2-15  
Chapter 3  
Programming with a Hand-held Programmer . . . . . . . . . . . . . . . . . .  
3-1  
Program Listing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Program Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Entering Program Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Inserting a Rung Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Deleting a Rung Element, Rung or Program In Memory . . . . . . . . . . . . .  
Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Programming Examples Using the HHP . . . . . . . . . . . . . . . . . . . . . . . . . . .  
3-2  
3-2  
3-3  
3-4  
3-5  
3-7  
3-8  
Chapter 4  
The Micro PLC Instruction Set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-1  
Instruction Set Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-2  
Contacts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Normally-Open Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Normally-Closed Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Positive Transition Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Negative Transition Contact . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-4  
4-5  
4-7  
4-9  
4-10  
v
GFK-0804B  
Micro PLC Programmers Guide - April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Contents  
Coils . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Output Coil . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Set/ ResetCoilPair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Master Control Relay/ End Coil Pair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Skip/ EndCoilPair . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-11  
4-12  
4-13  
4-14  
4-15  
Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
On Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Off Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-16  
4-18  
4-19  
Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Up Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Down Counter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-20  
4-22  
4-23  
Math Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Addition (ADD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Subtraction (SUB) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Multiplication (MUL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Division (DIV) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-24  
4-24  
4-26  
4-28  
4-30  
Move Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Block Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Indirect Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-32  
4-32  
4-34  
4-36  
Compare Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-38  
Logic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Word AND . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Inclusive OR (IOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Exclusive OR (XOR) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Shift Register Right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Shift Register Left . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
NOT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
4-40  
4-41  
4-42  
4-43  
4-44  
4-45  
4-46  
vi  
GFK-0804B  
Micro PLC Programmers Guide - April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Contents  
Appendix A Using Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
A-1  
B-1  
Appendix B  
Micro PLC Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Communications Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Communications Memory Types and Addresses . . . . . . . . . . . . . . . . . . . .  
Communications Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Communications Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Data Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Communications Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
B-2  
B-3  
B-3  
B-4  
B-4  
B-8  
Appendix C RTU Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
C-1  
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Transmission Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Character Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message Termination . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Timeout Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Cyclic Redundancy Check (CRC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
RTU Message Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message Descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (01): Read Output Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (02): Read Input Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (03): Read Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (04): Read Analog Inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (05): Force Single Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (06): Preset Single Register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (07): Read Exception Status . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (16): Preset Multiple Registers . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Message (17): Report Device Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Communication Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Invalid Query Message . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Serial Link Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Invalid Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
C-1  
C-2  
C-2  
C-3  
C-4  
C-4  
C-4  
C-5  
C-8  
C-9  
C-9  
C-10  
C-11  
C-12  
C-13  
C-14  
C-15  
C-16  
C-17  
C-18  
C-18  
C-19  
C-19  
Appendix D Communications Using Windows DDE . . . . . . . . . . . . . . . . . . . . . . .  
D-1  
Features of the Micro PLC DDE Driver Software . . . . . . . . . . . . . . . . . . . . . .  
Simple Demonstration using Microsoft Word . . . . . . . . . . . . . . . . . . . . . . . . .  
Demonstration using Microsoft Excel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Viewing PLC Data in Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Viewing PLC Data in another DDE-compliant Application . . . . . . . . . . . . . .  
Writing Values to the PLC from another Application . . . . . . . . . . . . . . . . . . .  
Ordering Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
D-2  
D-3  
D-3  
D-4  
D-5  
D-5  
D-5  
vii  
GFK-0804B  
Micro PLC Programmers Guide - April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Contents  
Appendix E  
Data Acquisition, Logging, and Display Program . . . . . . . . . . . . . .  
E-1  
Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Using the Display Software with Micro PLC Net . . . . . . . . . . . . . . . . . . . . . .  
Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Equipment Required . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Changing the Screen Colors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Editing Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Manual Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Creating or Editing Autopolling Screens . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
System Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Auto-Polling During System Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Data Logging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Error Messages During Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
E-1  
E-1  
E-2  
E-4  
E-5  
E-7  
E-8  
E-9  
E-13  
E-19  
E-21  
E-23  
E-25  
Appendix F  
ProgrammingApplications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
F-1  
Application #1: FLIP / FLOP (Toggle Operation) . . . . . . . . . . . . . . . . . . . .  
Application #2: Power Up One Shot (Start–up Protection) . . . . . . . . . . .  
Application #3: Cascading Counters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  
Application #4: Industrial “Starting Circuit” . . . . . . . . . . . . . . . . . . . . . . .  
F-2  
F-3  
F-4  
F-5  
viii  
GFK-0804B  
Micro PLC Programmers Guide - April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
restart lowapp ARestart oddapp: ARestarts for autonumbers that do not restart in  
each chapter. figure bi level 1, reset table_big level 1, reset chap_big level 1, reset1  
Lowapp Alwbox restart evenap:A1app_big level 1, resetA figure_ap level 1, reset  
table_ap level 1, reset figure level 1, reset table level 1, reset these restarts  
oddbox reset: 1evenbox reset: 1must be in the header frame of chapter 1. a:ebx, l 1  
resetA a:obx:l 1, resetA a:bigbx level 1 resetA a:ftr level 1 resetA c:ebx, l 1 reset1  
c:obx:l 1, reset1 c:bigbx level 1 reset1 c:ftr level 1 reset1 Reminders for  
autonumbers that need to be restarted manually (first instance will always be 4)  
let_in level 1: A. B. C. letter level 1:A.B.C. num level 1: 1. 2. 3. num_in level 1: 1. 2.  
3. rom_in level 1: I. II. III. roman level 1: I. II. III. steps level 1: 1. 2. 3.  
Chapter 1 Programmingfor the Micro PLC  
1
This chapter is an introduction to programming the Micro PLC.  
Programming Basics  
PLC Programs  
Power Flow in a Program  
The Micro PLC Instruction Set  
Programming Devices and Formats  
Programming with the Programming Software  
Programming on a Hand-held Programmer  
Memory Types and Addresses  
Memory Map  
Non-retentive and Retentive Registers  
Reserved Registers  
Constants and Register Values in a Program  
SpecialCoils  
0.1 Sec Clock (C1018)  
Start-up Scan Coil (C1019)  
Hold Output Coil (C1021)  
Programming for an Analog Expander Unit  
Analog Scaling  
Analog References  
Programming Examples  
1-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
1
Programming Basics  
The most important ingredients in creating a successful PLC program are a thorough  
understanding of the application itself, and a good measure of common sense.  
The first step in creating a PLC application program is planning.  
The desired sequence of program actions is determined.  
All of the required inputs and outputs are identified and listed.  
Each input and output is associated with a PLC memory location. For example:  
Device  
Designation  
Memory Location  
Start switch  
Input 1  
Input 2  
Input 3  
Input 4  
Input 5  
Discrete Input Table 1  
Limit switch on conveyor line  
Syrup tank #1, level detector  
Syrup tank #2, level detector  
Conveyor line optical sensor  
2
3
4
5
Conveyor line motor starter  
Operator warning light  
Signal to bottle capper  
Output 1  
Output 2  
Output 3  
Discrete Output Table1  
2
3
The program (like the short example program on the facing page) is created with a  
programming device and transferred to the PLC.  
Before the system begins full operation, the program is tested and any corrections  
that are needed are made.  
The final version of the program is transferred to the PLC, and the application is  
ready to go.  
GFK-0804B  
1-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
PLC Programs  
A typical PLC application program is created in a format called ladder logic.  
46101  
Output 1  
Output 2  
Input 1  
Input 2  
1
2
Input 3  
Input 4  
Input 5  
Output 3  
3
Each symbol in the ladder logic represents a type of input, output, or other program  
action. There are many types of symbols. The three symbols shown above are:  
46102  
Inputs  
Output  
normally–open  
contact  
normally–closed  
contact  
coil  
In the ladder logic, each line or group of lines that ends in an action being performed, such  
as an output being sent, is called a rung. In the example above, there are three rungs.  
Power Flow in a Program  
The PLC executes the logic in the ladder from top to bottom, one rung at a time. Within  
each rung, the execution flows from left to right. This movement of program execution  
through the ladder can also be thought of as power flow. In the example:  
Rung 1:  
Input 1 represents a switch. It is shown in the ladder logic program as a  
normally–open” contact. When the switch is turned on, the input 1 con-  
tact closes and power flows across rung 1 to the coil labelled Output 1.  
Rung 2:  
Rung 2 begins at the left side with two lines of logic that lead to the same  
output on the right. In this type of rung, which can have several lines  
beginning on the left, the output is ON if any of the input lines can be  
completed. In this rung, if either Input 2 or Input 3 is closed, Output 2 is  
turned ON.  
Rung 3:  
Rung 3 illustrates the use of multiple inputs in the same line of logic. All  
of these inputs must be completed for the output to be ON. In this exam-  
ple, Input 4 must be closed (active), and Input 5 must be closed (inactive)  
for Output 3 to be set to ON.  
GFK-0804B  
Chapter 1 Programming for the Micro PLC  
1-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
The Micro PLC Instruction Set  
Programs for a PLC are created from the elements provided in its Instruction Set. The  
Instruction Set for the GE Fanuc Micro PLC includes both basic relay-replacement  
contacts and many advanced program functions:  
Contacts  
Normally-open Contact  
Math functions  
Addition  
Normally-closed Contact  
Positive Transition Contact  
Negative Transition Contact  
Subtraction  
Multiplication  
Division  
Outputs  
Move functions  
Move  
Block Move  
Indirect Move  
Comparison functions  
Equal  
Output coil  
Set coil  
Reset coil  
Master Control Relay  
Skip/ Jump  
Timers  
Not Equal  
On Timer  
Off Timer  
Greater Than  
Less Than  
Counters  
Greater Than or Equal to  
Less Than or Equal to  
Logical operation functions  
AND  
Up Counter  
Down Counter  
Inclusive OR  
Exclusive OR  
Shift Right  
Shift Left  
Not  
GFK-0804B  
1-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
Programming Devices and Formats  
Programs for the Micro PLC can be created using a computer that is equipped with the  
programming software, or using a Hand-held Programmer.  
Programming with the Programming Software  
Programs created with the programming software are in traditional ladder logic format:  
46011  
I0001  
I0002  
O0030  
C0001  
I0003  
C0001  
Chapter 2 describes programming with the programming software.  
Programming on a Hand-held Programmer  
Equivalent programs are easily created on the Hand-held Programmer. For example:  
Key Operations  
HHP Displays  
STA I001  
START  
OUT  
I
O
I
1
3
2
ENTER  
ENTER  
ENTER  
Empty location  
OUT O030  
Empty location  
0
STA I002  
Empty location  
START  
OR C0001  
OR  
C
I
1
3
ENTER  
ENTER  
Empty location  
AND NOT I003  
Empty location  
AND  
F3  
OUT C0001  
Empty location  
OUT  
C
1
ENTER  
Chapter 3 describes programming with a Hand-held Programmer.  
Chapter 1 Programming for the Micro PLC  
GFK-0804B  
1-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
Memory Types and Addresses  
Memory Map  
Use for Timer  
or Counter  
Coil?  
General  
Purpose  
Internal Coil?  
Use as  
General  
Purpose  
Register?  
Use as  
Indirect  
Register  
Reference?  
Type Total  
Non  
Retentive  
Retentive  
256  
256  
512  
256  
256  
1017  
1
1 – 256  
1 – 256  
1 – 384  
1 – 256  
1 – 256  
1 – 768  
1018  
none  
none  
no  
yes  
yes  
yes  
no  
no  
no  
no  
yes  
no  
no  
no  
I
O
385 – 512*  
no  
no  
yes  
yes  
yes  
yes  
no  
R
notapplicable  
notapplicable  
yes  
notapplicable  
notapplicable  
yes  
IR  
OR  
C
no  
769 – 1017  
0.1 sec clock for use as input in application program (read only).  
Startup scan coil for use as input in application program. (read only)  
Hold output coil for use in application program (read only).  
C
1
1019  
C
1
1021  
C
Non-retentive and Retentive Registers  
Data assigned to retentive memory is saved if power is removed from the Micro PLC.  
Non-retentive registers are cleared to zero when power is removed, and when the  
Micro PLC is switched from Stop mode to Run mode.  
* Reserved Registers  
Retentive Registers 501 through 512 should not be used in your application program;  
they are reserved.  
Constants and Register Values in a Program  
Many program functions for the Micro PLC use either constants, or variables in registers.  
Constant values are limited to 32757 maximum. Single-register variables are limited to  
65535 maximum.  
GFK-0804B  
1-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
Special Coils  
The Micro PLC provides three special-purpose coils:  
0.1 sec clock  
start–up scan coil  
hold output coil  
0.1 Sec Clock (C1018)  
Coil C1018 is a pulse generator. The pulse width is shown below. This coil is a read-only  
coil. It can only be used as a program input, not as an output.  
46103  
Pulse  
signal  
50msec  
0.1 sec  
This coil should be used as a one-shot contact that feeds a regular coil.  
Start-up Scan Coil (C1019)  
When the controller starts operating, this coil goes ON for one scan. It is a read-only coil.  
It can only be used as a program input, not an output.  
46104  
Run/power on  
Stop/power off  
1 Scan  
Hold Output Coil (C1021)  
This coil can be used to control the state of the program outputs when the PLC is put in stop  
mode. As a group, all of the outputs can either hold their last state, or be set to OFF.  
If all outputs should hold their last state, set coil C1021 to ON (1).  
If all outputs should be set to OFF, set coil C1021 to OFF (0).  
Note: This function takes precedence over the Clear Data function of the programming  
software (key F7 in the Online menu).  
GFK-0804B  
Chapter 1 Programming for the Micro PLC  
1-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
Programming for an Analog Expander Unit  
Analog Scaling  
The Analog Expander Unit provides two 8-bit analog inputs and one 8-bit analog output.  
Scaling for an analog input or output is:  
Minimum:  
Maximum:  
0 volts = 0mA = 0 bits  
9.969 volts = 19.922mA = 255 bits  
Some examples of equivalent values are:  
Volts  
46190  
9.969  
7.5  
5
2.5  
0
0
64  
128  
192  
255 Bits  
AnalogReferences  
In a program, input 1 uses reference IR1. Input 2 uses reference IR2. The analog output  
uses reference OR1.  
Maximum Values  
The program references (IR1, IR2, and OR) used to store analog data are 16 bits each.  
However, the module utilizes only the lower 8 bits. Therefore, it is important not to  
inadvertently program a value greater than 255, which would cause incorrect results.  
For example, suppose you programmed an output value of 258. This is shown below in  
bits. Because the module uses only the lower 8 bits, it would interpret the value  
incorrectly.  
0
0
0
0
0
0
0
1
0
0
0
0
0
0
1
0
Higher 8 bits not used  
Only these 8 bits are used  
GFK-0804B  
1-8  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
1
Programming Examples  
Two simple programming examples are shown below.  
Example #1:  
For an analog input, the program might read the input value and turn on a discrete  
output when the analog input reaches a specific value. In this example, the program  
compares the value of the first analog input (IR1) with a value stored in register R4. If  
the analog input is greater than that value, then a discrete output (O18) is turned on.  
O18  
[IR1 > R4]  
The output that is turned on might represent an actual output device such as a switch, or  
a logical output that is used elsewhere in the program.  
Example #2:  
The logic below might be used for an analog output.  
[R3 ! OR1]  
In this example, each program scan, the Move function copies the content of register R3  
to reference OR1, which is the reference used by the analog output.  
GFK-0804B  
Chapter 1 Programming for the Micro PLC  
1-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Chapter 2 Programmingwith the Programming  
Software  
section level 1 1  
figure bi level 1  
table_big level 1  
2
This chapter explains how to create and edit a program using the Micro PLC  
programming software.  
Using the Programming Functions  
Creating a Program Rung  
Running the Programming Software  
Editing Basics  
Horizontal and Vertical Lines in a Rung  
Element Labels and Rung Labels  
Editing a Completed Rung  
Deleting Rungs  
Moving Rungs  
Copying Rungs  
Searching for a Rung or Program Element  
See the Micro PLC Users Guide if you need information about:  
Software installation  
Software functions  
Changing to another directory  
Loading a program file  
Saving a Program File  
Clearing a program from RAM memory  
Printing an application program  
Exiting the programming software  
Setup parameters  
Files and file-handling  
Monitoring a program online in the PLC  
2-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
2
Using the Programming Functions  
When you select Offline (F3) from the Main menu, the application program currently in  
the computer s RAM memory appears.  
If there is no program currently in RAM memory, the screen looks like this:  
The window shows the current rung, total number of rungs in the program, and  
program size in words. If you want to quit the Programming window, use the ESC key.  
Programming Operations  
In the Offline window, use the function keys to select a programming operation.  
Rung Create (F1)  
Rung Delete (F2)  
Search (F3)  
to create a new program rung  
to delete a program rung  
to search for a type of function or operand  
Edit (F4)  
to edit the rung at the top of the screen. After pressing  
F4, moves the cursor within the rung. PgUp, PgDn  
moves from rung to rung.  
Rung Move (F5)  
Rung Copy (F6)  
" Search (F7)  
to move a program rung  
to duplicate a program rung  
to search previous rungs (search backward)  
to search next program rungs (search forward)  
# Search (F8)  
Label Display (F9)  
Check (F10)  
to toggle between absolute and symbolic display  
to check program syntax.  
GFK-0804B  
2-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Programming Functions  
46105  
OFFLINE  
RUNG  
CREATE  
LABEL  
DISPLAY  
SEARCH  
RUNGMOVE  
" SEARCH  
RUNG  
DELETE  
EDIT  
RUNGCOPY  
SEARCH  
CHECK  
#
"
REF  
#
RUNG  
REF  
R LABEL  
LOGIC  
VERT LINE  
TIMER/COUNTER  
MATH / MOVE  
"
"
E LABEL  
COMP  
CLEAR  
HORI LINE  
ACCEPT  
RST  
SKIP  
SET  
MCR  
END  
( + ) ADD  
( * ) MUL  
MOVE  
I–MOVE  
( – ) SUB  
( / ) DIV  
B–MOVE  
ON TIMER  
UPCOUNTER  
SHIFTREG  
RIGHT  
AND  
XOR  
.EQ.  
.GT.  
.GE.  
DOWN  
COUNTER  
SHIFTREG  
LEFT  
OFFTIMER  
.NE.  
.LT.  
.LE.  
IOR  
NOT  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Creating a Program Rung  
Select Rung Create (F1) to create a new program rung. If there are already rungs in the  
program, the new rung will appear at the top of the page.  
You can now enter a program element in the highlighted location. Use the ESC key if  
you want to return to a previous menu.  
In the Edit window, use the function keys to select a program element.  
–| | – (F1)  
Normally-open contact. See page 4-4.  
Positive transition contact. See page 4-4.  
Normally-closed contact. See page 4-4.  
Negative transition contact. See page 4-4.  
Output. See page 4-11.  
–| " | – (Shift, F1)  
–| / | – (F2)  
–| #| – (Shift, F2)  
–( )– (F3)  
Timer/Counter (F4)  
Math/Move (F5)  
Comp (F6)  
Timer or Counter. See pages 4-16 and 4-19.  
Math or Move function. See pages 4-22 and 4-30.  
Compare function. See page 4-36.  
Element label. See page 2-8.  
E. Lbl (Shift, F6)  
Logic (F7)  
Logic function. See page 4-38.  
R. Lbl (Shift, F7)  
________ (F8)  
(F9)  
Rung label. See page 2-8.  
Draw horizontal (serial) line. See page 2-7.  
Draw or erase vertical (parallel) line. See page 2-7.  
Exit editing a rung. See page 2-6.  
Accept (F10)  
Clear (Shift, F10)  
Delete (clear) the rung being edited. Be careful.  
Note: the Delete key on your keyboard will remove the  
element at the current position in either Rung Edit or  
Rung Create mode.  
GFK-0804B  
2-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Running the Programming Software  
The programming software can be run from diskette, or installed on a hard disk. For  
installation instructions and information about the files on the software diskette, refer to  
the Micro PLC Users Guide (GFK-0803).  
Running the Programming Software from a Hard Disk  
1. Go to the directory where you placed the MICRO.EXE file. For example:  
C:>CD MICRO (Press the Enter key)  
2. To run the programming software, type:  
C:\ MICRO>MICRO (Press the Enter key)  
Running the Programming Software Directly from a Diskette  
1. Go to the DOS prompt if it is not already displayed:  
A:>  
2. Place the diskette containing the programming software into the appropriate  
diskette drive (for example, drive A). To run the programming software, type:  
A:>MICRO (Press the Enter key)  
3. Place a formatted diskette into drive B. You can use this diskette for storing  
configuration files.  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
2
Editing Basics  
After selecting Rung Create (F1):  
use the function keys to create an element and enter a reference value. For example,  
“I2”. (Note that the element reference cannot be entered as “2I”).  
use the cursor keys to move to another position in the rung being edited  
use your keyboard Delete key to delete a rung element.  
use your keyboard ESC key to quit a function or to return to the previous menu.  
To create another rung, press Rung Create (F1). The new rung appears.  
Initial display:  
Enter a function at the highlighted location. (Use the function keys)  
Move the highlight box. (Use the cursor keys)  
Enter the next function:  
When you enter a coil, the highlight box automatically goes to the end of the rung:  
After entering all the logic for the rung, use the Accept (F10) key to add it to the program. The  
disappearance of the highlight box shows that the software is not presently in Edit mode.  
GFK-0804B  
2-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Horizontal and Vertical Lines in a Rung  
Horizontal and vertical lines are used to connect elements of a multi-line rung.  
If a rung has more than one line of logic, move the highlight box down to the start  
of the next line. Enter the first element on that line.  
To add a horizontal line to the logic, move the highlight box to the location for the line.  
Use the  
(F8) key to add the horizontal line.  
Use the Delete key on your keyboard to remove a horizontal line.  
To add a vertical line to the logic, move the highlight box to the end location for the line.  
Use the  
(F9) key to add the vertical line.  
You must use the  
(F9) key to remove a vertical line.  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Element Labels and Rung Labels  
Element labels and rung labels are text that can be added to a program and viewed in  
Offline mode by selecting the Label Display function. Element and rung labels will also  
appear in their entirety in a hard copy printout or a print to disk. The first 5 characters of  
an element label can also be viewed in Online mode. (Think about this when selecting  
the element label.) To create an element label or rung label, follow the instructions  
below, in Edit or Create Rung mode.  
To create a label for an individual element, move the highlight box to that  
element. Press Enter to clear element edit. Then, press Shift, F6.  
Enter the text for the element label. Pressing the Enter (return) key ends text  
entry. Enter spaces if you want the label to have more than one line.  
After you press the Enter key, the element label disappears.  
To create a label for a rung, press Shift, F7.  
Enter the text for the rung label. Pressing the Enter (return) key ends text  
entry. Enter spaces if you want the label to have more than one line.  
After you press the Enter key, the element label disappears.  
GFK-0804B  
2-8  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Editing a Completed Rung  
After using the Accept (F10) key to save a rung, the rung can be changed by selecting  
Edit (F4) with the Offline function keys. The same basic programming features are  
available in both Create mode and Edit mode. Refer to the previous descriptions of  
program functions and editing techniques.  
While editing a rung, you can delete, add, or change rung elements within the rung as  
described below and on the following pages.  
If you want to delete or move an entire rung, see page 2-13.  
Selecting a Rung to Edit  
To select a rung for display or editing, use the cursor keys to scroll the program up or  
down on the screen. Or you can use the Search function to locate a specific rung,  
element, or reference.  
Bring the rung you want to edit to the top of the screen.  
To edit the rung, use the Edit (F4) key. In Edit mode, you can add elements to the rung,  
or edit the elements that are already there. You can then use the cursor keys to move  
the cursor within a rung, and the PgUp, PgDn keys to move from rung to rung.  
Editing a Rung Element  
In Edit mode, the highlight box selects the rung element that can be edited.  
Use the cursor keys to move to the highlighted box.  
Enter the reference and address, then press the Enter key or a cursor key to go to the  
next rung element.  
Deleting a Rung Element  
Delete the highlighted element by pressing the Delete key on your keyboard. (If the  
small edit cursor is displayed in the highlight box, first press the Enter key to remove it).  
This creates an empty space in the rung. If you do not want to add an element at that  
location, insert a horizontal line (F8).  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Addinga Contact to a Rung  
To add a contact to a rung, move the highlight box to the location for the new contact.  
Add the contact using its function key. Enter a reference for the contact and press the  
Enter key, or use the cursor keys to move to a new position.  
Addinga Program Function to a Rung  
If you want to add something other than a contact (for example, an Equal function) to a  
rung, first create a space for it. Position the highlight box where the function should  
begin, then press your keyboard Delete key. If the element to be added requires 2 or 3  
consecutive spaces, move the highlight box, then press the Delete key again.  
Move the highlight cursor back to the leftmost empty space:  
Add the function using its function key. Edit the function as necessary.  
GFK-0804B  
2-10  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Replacing a Rung Element with a Similar Element  
To replace a rung element with a similar element (for example, to replace a normally-open  
contact with a normally-closed contact), select the element with the highlight box.  
Press the function key that corresponds to the new element type. Edit it if necessary.  
Replacing a Rung Element with a Horizontal Line  
To replace a rung element with a horizontal line, select it with the highlight box:  
Then , select the horizontal line (F8).  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-11  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Replacing a Rung Element with a Dissimilar Element  
To replace an element with an element of a different type (for example, to change a  
normally-open contact to an Equals function), select the element with the highlight box.  
First, delete the element by pressing the Delete key on your keyboard. (If the small edit  
cursor is displayed in the highlight box, first press the Enter key to remove it).  
This creates an empty space in the rung. If you do not want to add an element at that  
location, insert a horizontal line (F8).  
If you want to add an element at that location, use the appropriate function key to enter it.  
You may need to delete more than one existing element to insert a new element if the  
new element is wider than the element it is replacing.  
GFK-0804B  
2-12  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
2
Deleting Rungs  
To delete one or more rungs, use the Rung Delete (F2) key. The software prompts:  
The first number that appears is the number of the rung that is now at the top of the  
screen. If you want to delete just that rung, press the Enter key.  
If you want to delete a different rung, or a group of rungs, enter their rung numbers  
then press the Enter key.  
If you want to quit the Delete function without deleting any rungs, press the ESC key.  
Moving Rungs  
You might want to move rungs to make a program more understandable, or to group  
rungs together that work with each other.  
To move one or more rungs, use the Rung Move (F5) key. The software prompts:  
The first number that appears is the number of the rung that is now at the top of the screen.  
Enter the numbers of the rungs to be moved, and the number of the rung you want to  
insert them in front of. Press the Enter key.  
If you want to quit the Move function without moving any rungs, press the ESC key.  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-13  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Copying Rungs  
You might want to copy rungs and then make simple changes to the rungs rather than  
enter new rungs.  
To copy one or more rungs, use the Rung Copy (F6) key. The software prompts:  
The first number that appears is the number of the rung that is now at the top of the screen.  
Enter the numbers of the rungs to be copied, and the number of the rung you want to  
insert the copied rungs in front of. Press the Enter key.  
If you want to quit the Copy function without copying any rungs, press the ESC key.  
GFK-0804B  
2-14  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
2
Searching for a Rung or Program Element  
You can search for a specific program rung, contact or coil, reference address, number, or  
program function. Select Search (F3) in Offline mode, then use the function keys described  
below to select the target of the search. Finally, use the " Search (F7) and # Search (F8) keys  
to specify the search direction.  
Rung (F1)  
rung number  
Type in a rung number and  
press the Enter key.  
–] [– (F2) normally-open contact  
–] / [– (F3) normally-closed contact  
–] " [– (F4) positive transition contact  
–] # [– (F5) negative transition contact  
–( )– (F6) coil  
Type in a reference address and  
press the Enter key.  
Ref (F7)  
reference  
Type in a reference address and  
press the Enter key.  
Number (F8) number  
Type in a number and  
press the Enter key.  
Func (F10)  
program function  
Type in a number and  
press the Enter key.  
GFK-0804B  
Chapter 2 Programming with the Programming Software  
2-15  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Chapter 3 Programmingwith a Hand-held Programmer  
section level 1 1  
figure bi level 1  
table_big level 1  
3
This chapter explains how use a Hand-held Programmer for programming the  
GE Fanuc Micro PLC.  
Program Listing  
Program Transfer  
Entering Program Logic  
Inserting a Rung Element  
Deleting a Rung Element, Rung or Program In Memory  
Searching  
Programming Examples Using the HHP  
3-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
3
Program Listing  
To display the program listing, press the ENTER key from the powerup screen.  
PROGRAM  
Empty  
START  
location  
Program Transfer  
To transfer a program, press the XFER key from the program listing screen.  
TRANSFER  
PLC PROM  
TO/FROM  
PC  
The Hand-held Programmer will transfer the program to or from the Micro PLC,  
EEPROM, or the programming software in the computer.  
GFK-0804B  
3-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Entering Program Logic  
The steps below show how to create a simple example program.  
Example Program  
46011  
O0030  
C0001  
I0001  
I0003  
I0002  
C0001  
Hand-Held Programmer Key Operation and Displays  
use the ENTER key to accept a command.  
On the display, empty location” refers to the current unoccupied program line.  
Key Operations  
HHP Displays  
STA I001  
Empty location  
START  
OUT  
I
O
I
1
3
2
ENTER  
ENTER  
ENTER  
OUT O030  
Empty location  
0
STA I002  
START  
Empty location  
OR C0001  
Empty location  
OR  
C
I
1
3
ENTER  
ENTER  
AND NOT I003  
Empty location  
AND  
F3  
OUT C0001  
OUT  
C
1
ENTER  
Empty location  
GFK-0804B  
Chapter 3 Programming with a Hand-held Programmer  
3-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Inserting a Rung Element  
The steps below show how to insert an element in a simple example program.  
Example Program  
46106  
I3  
O17  
I1  
I5  
Element  
"
is to be  
O17  
added to the program as shown  
I5  
"
In this example, the statement OR PTRAN I005 is inserted between the existing  
statements:  
AND NOT I003  
OR PTRAN I005  
OUT O017  
Hand-Held Programmer Key Operation and Displays  
use the SRCH key to locate the ladder logic rung to be edited. The display selects the  
last element in the selected rung.  
Use the PREV key to select the previous element. In this example, it is:  
AND NOT I003 (see below).  
use the PREV key to scroll the program display backward.  
use the NEXT key to scroll the program display forward.  
Key Operations  
HHP Displays  
OUT O017  
Empty location  
SRCH  
PREV  
OR  
1
ENTER  
AND NOT I003  
OUT O017  
OR PTRAN I005  
OUT O017  
F1  
I
5
ENTER  
GFK-0804B  
3-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Deleting a Rung Element, Rung or Program In Memory  
The steps below show how to use the HHPs delete function key to delete a program or  
part of a program in memory.  
Hand-Held Programmer Key Operation and Displays  
use the SRCH key to locate the ladder logic rung to be edited. The display selects the  
last element of the rung. Use the PREV key to select a previous element.  
use the PREV key to scroll the program display backward.  
use the NEXT key to scroll the program display forward.  
use the DEL key and F1 key to delete a program element.  
use the DEL key and F2 key to delete a rung.  
use the DEL key and F3 key to delete a program.  
Key Operations  
HHP Displays  
Elem Rung Prog  
F1 F2 F3  
DELETE  
Elem Rung Prog  
DEL  
F1  
Delete the program element currently displayed.  
DELETE  
DEL  
F2  
Elem Rung Prog  
Delete the program rung currently displayed.  
DELETE PROGRAM  
ENTER=YES,ESC=No  
DEL  
F3  
Delete the current program.  
GFK-0804B  
Chapter 3 Programming with a Hand-held Programmer  
3-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Deleting a Rung Element  
The steps below show how to delete an element of a simple example program.  
Example Program  
46107  
I3  
O17  
I5  
I1  
I1  
Element  
is to be  
I6  
removed from the program  
as shown.  
AND NOT I003  
OR PTRAN I005  
OUT O017  
Hand-Held Programmer Key Operation and Displays  
use the SRCH key to locate the ladder logic rung to be edited. The display selects the  
last element of the rung. Use the PREV key to select a previous element.  
use the DEL key and F1 key to delete a program element.  
use the PREV key to scroll the program display backward.  
use the NEXT key to scroll the program display forward.  
Key Operations  
HHP Displays  
OUT O017  
Empty location  
SRCH  
PREV  
DEL  
1
ENTER  
AND I1  
OUT O017  
AND NOT I003  
OUT O017  
F1  
GFK-0804B  
3-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Searching  
Use the SRCH key to locate a rung, element, or operand in a program. The steps below  
show how to search for an operand, element, or rung umber, or the start or end of the  
program.  
Hand-Held Programmer Key Operation and Displays  
Key Operations  
HHP Displays  
enter  
number  
AND I001  
OUT O017  
SRCH  
I/O  
ENTER  
The search operand may be I, O, IR, OR, C, or R.  
C R001 To 100  
Empty location  
SRCH  
CNTR  
F1  
F2  
ENTER  
or  
This example searches for a counter (either up or down).  
OUT O040  
SRCH  
1
0
ENTER  
Empty location  
This example searches for rung number 10.  
PROGRAM START  
STA I001  
SRCH  
0
To locate the start of the program, search for rung 0.  
OUT O040  
SRCH  
ENTER  
Empty location  
To locate the end of the program, search with no rung number.  
PLC TRANSFER  
Open Rung  
An open rung or other program error was encountered.  
PLC TRANSFER  
PLC in RUN Mode  
The PLC was in Run mode when the transfer was attempted.  
GFK-0804B  
Chapter 3 Programming with a Hand-held Programmer  
3-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Programming Examples Using the HHP  
Example 1  
46108  
Ladder Diagram  
Key Operations  
I2  
I1  
I3  
C1  
START  
AND  
START  
AND  
OR  
START  
AND  
I1  
I2  
I3  
I4  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
I4  
I6  
F3 (NOT)  
I5  
I6  
OR  
OUT  
I5  
C1  
Example 2  
46109  
Ladder Diagram  
Key Operations  
I2  
I1  
I3  
C2  
START  
OR  
OR  
START  
OR  
OR  
I1  
I3  
I5  
I2  
I4  
I6  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
F3 (NOT)  
I4  
I6  
AND  
OUT  
C2  
I5  
Example 3  
46110  
Ladder Diagram  
Key Operations  
I6  
C1 C4  
C2  
START  
START  
AND  
OR  
AND  
START  
AND  
START  
AND  
OR  
F1 (PTRAN)  
I6  
C2  
C21  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
"
F3 (NOT)  
F3 (NOT)  
C2  
C21  
C1  
O38  
C51  
C38  
C51  
O38 C51  
C1  
F3 (NOT)  
F3 (NOT)  
F3 (NOT)  
AND  
OR  
AND  
OUT  
C1  
C38 C51  
C4  
C2  
GFK-0804B  
3-8  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
3
Example 4  
46111  
Ladder Diagram  
Key Operations  
I1  
I2  
I5  
I3  
I4  
C2  
START  
OR  
START  
OR  
AND  
START  
OR  
AND  
OR  
START  
OR  
OR  
AND  
AND  
OUT  
F1 (PTRAN)  
I1  
I4  
I2  
I5  
ENTER  
"
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
F3 (NOT)  
F3 (NOT)  
I4  
C5  
I6  
I9  
I7  
I6  
I9  
I7  
I8  
F3 (NOT)  
F3 (NOT)  
I3  
C5  
I8  
I4  
C2  
Example 5  
46112  
Ladder Diagram  
Key Operations  
C1  
C2  
C3  
C4  
RI  
START  
START  
TIMER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
ENTER  
F1 (PTRAN)  
F1 (ONTIM)  
C1  
R1  
10  
C1  
ONTMR  
10  
"
OUT  
C1  
C1  
START  
START  
CNTR  
F1 (PTRAN)  
F1 (PTRAN)  
F1 (UPCNT)  
C1  
C2  
R2  
60  
R2  
"
C2  
UPCTR  
60  
"
OUT  
C2  
START  
START  
CNTR  
F1 (PTRAN)  
F1 (PTRAN)  
(F1 (UPCNT)  
C2  
C3  
R3  
60  
C2  
R3  
"
C3  
UPCTR  
60  
OUT  
C3  
"
START  
START  
CNTR  
F1 (PTRAN)  
F1 (PTRAN)  
F1 (UPCNT)  
C3  
C4  
R4  
24  
C3  
R4  
"
OUT  
C4  
C4  
UPCTR  
24  
"
GFK-0804B  
Chapter 3 Programming with a Hand-held Programmer  
3-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Chapter 4 The Micro PLC Instruction Set  
section level 1 1  
figure bi level 1  
table_big level 1  
4
This chapter defines the individual logic elements that can be combined to make a  
program for the Micro PLC.  
Instruction Set Summary  
Contacts  
Math Functions  
Addition (ADD)  
Normally-Open Contact  
Normally-Closed Contact  
Positive Transition Contact  
Negative Transition Contact  
Coils  
Subtraction (SUB)  
Multiplication (MUL)  
Division (DIV)  
Move Functions  
Move  
Output Coil  
Block Move  
Set/ ResetCoilPair  
Indirect Move  
Compare Functions  
Logic Operations  
Word AND  
Master ControlRelay/ End Coil  
Pair  
Skip/ EndCoilPair  
Timers  
Inclusive OR (IOR)  
Exclusive OR (XOR)  
Shift Register Right  
Shift Register Left  
NOT  
On Timer  
Off Timer  
Counters  
Up Counter  
Down Counter  
4-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Instruction Set Summary  
Operation  
Ladder Symbol  
Description  
Normally-open contact  
/
"
#
Normally-closed contact  
Positive transition  
Negative transition  
Output coil  
Contact  
SET  
RST  
MCR  
SKIP  
END  
Set coil  
Reset coil  
Output  
Master Control Relay  
Skip/jump operation  
Ending operation for a skip or jump  
ONTMR  
R###  
XXXX  
On Timer  
Variable Register R### (R1 – R500)  
Timer Setting XXXX (Timebase 0.1S)  
Timer  
Off Timer  
OFTMR  
R###  
XXXX  
Variable Register R### (R1 – R500)  
Timer Setting XXXX (Timebase 0.1S)  
UPCTR  
R###  
XXXX  
Up Count  
Variable Register R### (R1 – R500)  
Timer Setting XXXX  
Counter  
Down Counter  
Variable Register R### (R1 – R500)  
Timer Setting XXXX  
DNCTR  
R###  
XXXX  
[???+???! ???]  
[???–???! ???]  
Addition  
Subtraction  
Multiplication  
Math  
Functions  
[???x???! ???]  
[???B ???! ???]  
Division  
GFK-0804B  
4-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Operation  
Ladder Symbol  
Description  
[???! ???]  
Move  
L
Move  
Operations  
[???E???! ???]  
Block Move  
N
[???! @???]  
Indirect Move  
[S1 = S2]  
[S1 > S2]  
[S1 < S2]  
[S1 > S2]  
[S1 < S2]  
[S1 0 S2]  
Continue when S1 = S2  
Continue when S1 > S2  
Continue when S1 < S2  
Continue when S1 > S2  
Continue when S1 < S2  
Continue when S1 0 S2  
Compare  
Function  
X
1
1
0
0
Y
1
0
1
0
O
1
0
0
0
A
[???N???! ???]  
AND  
IOR  
D
X
1
1
0
0
Y
1
0
1
0
O
1
1
1
0
I
[???O???! ???]  
R
X
1
1
0
0
Y
1
0
1
0
O
Logic  
Operation  
X
0
1
1
0
[???O???! ???]  
XOR  
R
S
[???H???! ???]  
Shift Right  
R
S
[???H???! ???]  
Shift Left  
Not  
L
[??? ! ???]  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Contacts  
The Micro PLC instruction set includes the following contacts:  
–| | –  
–| " | –  
–| / | –  
–| #| –  
Normally-open contact. Passes power flow to the right when its  
associated reference is = 1.  
Positive transition contact. Passes power flow to the right for one  
program cycle when its associated reference changes from 0 to 1.  
Normally-closed contact. Passes power flow to the right while its  
associated reference is = 0.  
Negative transition contact. Passes power flow to the right for one  
program cycle when its associated reference changes from 1 to 0.  
Each of these contact types is described more fully on the pages that follow. If you are  
using the programming software, refer to the programming instructions below. If you  
are using the Hand-held Programmer, refer to the instructions for each contact type.  
General Programming Software Instructions for Contacts  
1. Select the contact type using the function keys:  
–| | – (F1)  
Normally-open contact.  
Positive transition contact.  
Normally-closed contact.  
Negative transition contact.  
–| " | – (Shift, F1)  
–| / | – (F2)  
–| #| – (Shift, F2)  
The selected contact type is displayed:  
2. Enter an appropriate address. For a contact, enter an address in input (I), output (O),  
or internal (C) memory. For example: I4. You dont need to enter leading zeros.  
Note that you cannot enter the reference as “4I”.  
3. Press the Enter key. The memory type and address appear:  
If you want to change the memory type and address, press the Enter key. A cursor  
appears next to the address. Type in the new memory type and address. Press the Enter  
key again to accept the new entry.  
GFK-0804B  
4-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Normally-OpenContact  
A Normally-Open contact passes power flow to the right when the associated reference  
is equal to 1.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on the opposite  
page.  
Examples and HHP Instructions  
The HHP programming keystrokes to create a Normally-Open contact depend on its  
position in a rung, as explained below.  
Programming Normally-Open Contact at the Start of a Rung  
When a Normally-Open contact is the first element of the rung, program a START, as  
shown below.  
46114  
Ladder Diagram  
Hand-held Programmer  
I1  
O17  
START  
OUT  
I1  
O17  
Timing Diagram  
1
1
0
0
0
Input I1  
The output O17 status follows the  
signal of input I1, when I1–1,  
output O17=1.  
Output O17  
0
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Programming a Normally-Open Contact in Series  
When a Normally-Open contact is not the first element of the rung, program an AND  
with the HHP, as shown below. The example shows how to use the HHP to program a  
Normally-Open contact at the first and second positions in a rung.  
46115  
Ladder Diagram  
Hand-held Programmer  
I2  
I1  
O17  
I1  
I2  
O17  
START  
AND  
OUT  
Timing Diagram  
Input I1  
Input I2  
AND operation of inputs I1 and I2;  
output O17 is 1 when I1 and I2 are  
both 1.  
Output O17  
Programming a Normally-Open Contact in Parallel  
To enter a Normally-Open contact in parallel, as shown by I2 in the following example,  
program an OR with the HHP.  
46116  
Ladder Diagram  
Hand-held Programmer  
I1  
I2  
O17  
START  
OR  
OUT  
I1  
I2  
O17  
Timing Diagram  
Input I1  
Input I2  
OR operation of inputs I1 and I2.  
The output O17 is 1 when either I1  
or I2 is 1.  
Output O17  
GFK-0804B  
4-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Normally-ClosedContact  
A Normally-Closed contact passes power flow to the right when the associated reference  
is equal to 0.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-4.  
Examples and HHP Instructions  
The HHP programming keystrokes to create a Normally-Closed contact depend on its  
position in a rung, as explained below.  
Programming Normally-Closed Contact at the Start of a Rung  
When a Normally-Closed contact is the first element of the rung, program a  
START NOT, as shown below.  
46017  
Ladder Diagram  
Hand-held Programmer  
I2  
O18  
START  
OUT  
F3 (NOT)  
II2  
O18  
Timing Diagram  
The output O18 status is the  
reverse signal of input I2, when  
I2=1, output O18=0.  
Input I2  
Output O18  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Programming a Normally-Closed Contact in Series  
When a Normally-Closed contact is not the first element of the rung, program an  
AND NOT with the HHP, as shown below. The example shows how to use the HHP to  
program a Normally-Closed contact at the first and second positions in a rung.  
46018  
Ladder Diagram  
Hand-held Programmer  
I3  
I4  
O18  
I4  
I3  
O18  
START  
AND  
OUT  
F3 (NOT)  
F3 (NOT)  
Timing Diagram  
Input I3  
NAND operation of inputs I3 and  
I4; output O18 is 1 when I3 and I4  
are both 0.  
Input I4  
Output O18  
Programming a Normally-Closed Contact in Parallel  
To enter a Normally-closed contact in parallel, as shown by I3 in the following example,  
program an OR NOT with the HHP.  
46019  
Ladder Diagram  
Hand-held Programmer  
I1  
O17  
START  
OR  
I1  
I2  
OR  
OUT  
I3  
O17  
F3 (NOT)  
I2  
I3  
Timing Diagram  
Input I1  
Input I2  
Input I3  
OR operation of inputs I1 and I2  
and the reverse signal of I3. The  
output O17 is 1 when either I1 or  
I2 is 1 or I3 is 0.  
Output O17  
GFK-0804B  
4-8  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Positive Transition Contact  
The Positive Transition contact passes power flow to the right for one program cycle  
when its reference changes from 0 to 1.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-4.  
Example and HHP Instructions  
46020  
Ladder Diagram  
Hand-held Programmer  
I1  
"
O17  
START  
OUT  
I1  
O17  
F1(PTRAN)  
Timing Diagram  
Input I1  
Upon the rising edge signal of  
input I1, output O17 is activated.  
The status of O17 remains 1 for  
only one program cycle.  
Output O17  
!
z
1 scan  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Negative Transition Contact  
The Negative Transition contact passes power flow to the right for one program cycle  
when its reference changes from 1 to 0.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-4.  
Example and HHP Instructions  
46021  
Ladder Diagram  
Hand-held Programmer  
I1  
#
O17  
START  
OUT  
I1  
O17  
F2(NTRAN)  
Timing Diagram  
Input I1  
Upon the falling edge signal of  
input I1, output O17 is activated.  
The status of O17 remains 1 for  
only one program cycle.  
Output O17  
!
z
1 scan  
GFK-0804B  
4-10  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Coils  
The Micro PLC instruction set includes the following coils:  
–(  
)–  
Coil. The basic type of program output.  
–(SET)–  
–(RST)–  
–(MCR)–  
–(SKIP)–  
–(END)–  
Set coil. Used to set a specified reference to 1.  
Reset coil. Used to reset the same specified reference to 0.  
Master Control Relay. Used to set a group of outputs to 0.  
Skip. Used to cause a group of outputs to hold last state.  
End of MCR or Skip  
Using Coil Pairs  
The following types of coils must always be used in pairs. If one of these instructions is  
used in the program, the paired instruction must also exist somewhere in the program.  
SET  
MCR  
SKIP  
RST  
END  
END  
Set and Reset  
Master Control Relay and End MCR  
Skip (rungs) to rung containing End  
General Programming Software Instructions for Coils  
1. Select –( )– (F3), then use the assigned function key(s) to select an output type:  
–(  
)–  
(F1)  
(F2)  
(F3)  
Coil  
Set coil  
Reset coil  
–(SET)–  
–(RST)–  
–(MCR)– (F4)  
–(SKIP)– (F5)  
–(END)– (F6)  
Master Control Relay  
Skip  
End of MCR or Skip  
The selected coil type appears at the end of the rung:  
2. Enter an appropriate address. For a coil, enter an address in output (O) or internal  
coil (C) memory. For example, C0001. You dont need to enter leading zeros.  
3. Press the Enter key. The memory type and address appear:  
If you want to change the memory type and address, press the Enter key. A cursor  
appears next to the address. Type in the new memory type and address. Press the Enter  
key again to accept the new entry.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-11  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
OutputCoil  
The basic type of output coil is controlled by conditional logic within the same rung.  
When the coil receives power flow from logic to its left in the rung, the reference  
associated with that coil is set to 1. When no power flow is received, the reference is 0.  
The state of output coils may also be affected if they are between an MCR/ End MCR coil  
pair or a Skip/ End coil pair, as explained on the following pages.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-11.  
Examples and HHP Instructions  
46022  
Ladder Diagram  
Hand-held Programmer  
I1  
O17  
START  
OUT  
I1  
O17  
START  
OUT  
O18  
O18  
Timing Diagram  
Input I1  
Output O17 follows the status of  
input I1. Output O18 is  
Output O17  
unconditional; it always remains 1.  
1
0
Output O18  
GFK-0804B  
4-12  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Set/Reset Coil Pair  
The Set/ Reset coil pair can be used to control the state of an associated reference. The Set  
coil sets the reference to 1. The reference (O17 in the example below) STAYS set to 1 until  
it is reset to 0 by the Reset coil. Notice that the Set and Reset coil are programmed with  
the same associated reference; that of reference being controlled.  
In the example below, the Set coil and Reset coil are shown in adjoining rungs of logic.  
That is not necessary, however.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-11.  
Example and HHP Instructions  
Set  
Reset  
SET  
RST  
46023  
Ladder Diagram  
Hand-held Programmer  
I1  
I2  
O17  
SET  
START  
OUT  
START  
OUT  
I1  
O17  
I2  
F2(SET)  
O17  
RST  
O17  
F2(RESET)  
Timing Diagram  
This is a flip-flop operation. Input I1 sets  
output O17 to 1. Output O17 remains 1  
even if I1 changes to 0. Output O17 is only  
reset to 0 when I2 is activated.  
Input I1  
Input I2  
When both I1 and I2 are ON, the last  
occurrence in the scan (RST in this case)  
takes precedence.  
Output O17  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-13  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Master Control Relay/End Coil Pair  
The MCR/ End coil pair can be used to turn off one or more outputs in the program,  
regardless of the state of any inputs or other conditional logic to those outputs. The rungs with  
the outputs to be controlled must be located between the Master Control Relay coil and  
its paired End coil in the program.  
In the example below, the MCR and End MCR coil control the states of outputs C1 and  
O17. While the Master Control Relay coil receives power flow from its conditional logic  
(in the example, it is contact I1), all output coils within the MCR/ End MCR pair go to 0.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-11.  
Example and HHP Instructions  
MCR  
End  
MCR  
END  
46024  
Ladder Diagram  
Hand-held Programmer  
I1  
I2  
MCR  
START  
OUT  
START  
OUT  
START  
OUT  
I1  
F1(MCR)  
MoreMENU  
C1  
C1  
I2  
O17  
O17  
OUT  
F3 (END MCR)  
MoreMENU  
END  
Timing Diagram  
This is a Master Control Relay operation.  
When I1 is 0, the program till the END  
command operates normally.  
Input I1  
Coil C1  
Input I2  
When input I1 is 1, all outputs before the  
END are disabled.  
Output O17  
GFK-0804B  
4-14  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Skip/End Coil Pair  
The Skip/ End coil pair can be used to cause one or more outputs in the program to stay  
in their current state (1 or 0), regardless of the state of any inputs or other conditional logic to  
those outputs. The rungs with the outputs to be controlled must be located between the  
Skip coil and its paired End coil in the program.  
In the example below, the Skip and End coil control the states of outputs O17 and O18.  
While the Skip coil receives power flow from its conditional logic (in the example, it is  
contact I1), all output coils within the Skip/ End pair hold their last states.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-11.  
Example and HHP Instructions  
Skip  
End  
SKIP  
END  
46025  
Ladder Diagram  
Hand-held Programmer  
I1  
I2  
I3  
SKIP  
START  
OUT  
START  
OUT  
START  
OUT  
I1  
More MENU F2 (SKIP)  
I2  
O17  
I3  
O18  
O17  
O18  
F3 (NOT)  
START  
OUT  
END  
More MENU F3 (END)  
Timing Diagram  
Input I1  
This is a Skip to END operation. When  
input I1 is 0, the Skip command is not  
performed.  
Input I2  
Output O17  
Input I3  
When input I1 is 1, all outputs till END  
are on hold, and are not affected by input  
conditions.  
Output O18  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-15  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Timers  
The Micro PLC instruction set provides two Timers:  
On Timer  
Off Timer  
Sets an output to 1 after a specified time period. See page 4-17.  
Sets an output to 0 after a specified time period. See page 4-18.  
Programming Software Instructions for Timers  
Timers require input logic in the same rung. This can be entered either before selecting  
the Timer function, or after as described below. Note that the enable line for a timer  
CANNOT contain parallel branches or instructions. If this type is logic is desired, place it  
in another rung, using it to drive an internal coil which then drives the timer.  
1. To enter a Timer, select Timer/Counter (F4), then On Timer (F1) or Off Timer (F2).  
2. For the top parameter, enter a register location for the PLC to store the current  
value of the timer as it increments. For example: R001. Then press the Enter key.  
3. For the other parameter, enter the timer length in intervals of 1/10 second. For  
example, for a 10-second timer, enter 100.  
If you want to change a parameter, press the Enter key. Type in the new value and  
press the Enter key again to accept the new entry.  
4. Enter the other logic required by the Timer:  
A. Logic in the top line to enable timing. Timing only takes place while this line  
passes power flow to the Timer.  
B. Logic in the bottom line that will clear the current Timer value to 0 when it  
passes power flow to the Timer.  
C. An output that will be turned On (for an On Timer) or Off (for a Down Timer)  
when the Timer reaches the desired value (in this example, 10 seconds).  
5. Use the Accept (F10) key to add the rung to the program.  
GFK-0804B  
4-16  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
On Timer  
The On Timer turns ON an output after a specified time period. The time period can be  
from 0 to 6553.5 seconds. However, if a constant is used for the Preset value, the time  
period can be from 0 to 3276.7 seconds. To program a timer function, enter two inputs  
(in the example below, I1, and I2), and two parameters (R1 and 100 in the example).  
The first input controls operation of the timer. Timing only occurs while I1 is 1. The  
second input to the timer clears the current timer value to 0.  
The first timer parameter is a register memory location for PLC to store the current timer  
value.  
The second timer parameter is the timer length, in intervals of 0.1 second. If this number  
should always be the same, you can enter it directly, as shown in the example. Or, if you  
want to be able to change the timer length using the Hand-held Programmer, instead  
enter a register from R385 to R500 as the second parameter for the timer. The current  
timer value (in R1 below) will not increment beyond its programmed length (time  
period), even if I1 remains closed and I2 remains open.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-16.  
Example and HHP Instructions  
46026  
Ladder Diagram  
Hand-held Programmer  
I1  
I2  
C1  
START  
START  
TIMER  
I1  
I2  
R1  
100  
C1  
R1  
ONTMR  
100  
F1  
OUT  
Timing Diagram  
When I1 is 1, the timer is enabled. The timer  
setting is:  
Input I1  
Input I2  
100 x 0.1 = 10 Sec.  
During the operation of the timer, if I1  
switches to 0, the timer is on hold. When I1 is  
1 again, the timer resumes timing.  
100  
Register R1  
Coil C1  
0
When the timer reaches the set value (10  
seconds), output coil C1 activates.  
Input I2 is used to reset the timer. When both  
I1 and I2 are on, the timer remains reset.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-17  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Off Timer  
The Off Timer turns OFF an output after a specified time period. The time period can be  
from 0 to 6553.5 seconds. However, if a constant is used for the Preset value, the time  
period can be from 0 to 3276.7 seconds.  
To program a timer function, enter two inputs (in the example below, I1, and I2), and  
two parameters (R1 and R385 in the example). In this example, the timer length is not  
specified directly. Instead, this example uses the register R385 as the second parameter.  
In this case, register R385 contains the value 100. The timer length can be placed in that  
register either by program logic or from the Hand-held Progammer or programming  
software.  
When the program encounters a register location as the second parameter of the timer, it  
looks in that register for the value it contains, and uses that value as the timer length. So  
for this example, timing is the same as for the previous example.  
The current timer value (in R1 above) will not increment beyond its programmed length  
(time period), even if I1 remains closed and I2 remains open.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-16.  
Example and HHP Instructions  
46027  
Ladder Diagram  
Hand-held Programmer  
I1  
I2  
C1  
START  
START  
TIMER  
I1  
I2  
R1  
R385  
C1  
R1  
OFTMR  
R385  
F1  
OUT  
Timing Diagram  
When I1 is 1, the timer is started. The  
timer setting is:  
Input I1  
Input I2  
100 x 0.1 = 10 Sec.  
During the operation of the timer, if I1  
switches to 0, the timer is on hold. When  
I1 is 1 again, the timer resumes timing,  
100  
0
Register R1  
Coil C1  
When the timer reaches the set value (10  
seconds), output coil C1 deactivates.  
Input I2 is used to reset the timer. When  
both I1 and I2 are ON, the timer remains  
reset.  
GFK-0804B  
4-18  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Counters  
The Micro PLC instruction set includes two Counters:  
Up Counter Sets an output to 1 when the counter is equal to a specified  
value. See page 4-20.  
Down Counter Sets an output to 1 when the counter reaches 0. See page 4-21.  
Programming Software Instructions for Counters  
Counters require input logic in the same rung. This can be entered either before selecting  
the Counter function, or after as described below. Note that the count line for a counter  
CANNOT contain parallel branches or instructions. If this type is logic is desired, place it  
in another rung, using it to drive an internal coil which then drives the timer.  
1. Select Timer/Counter (F4), then Up Counter (F3) or Down Counter (F4).  
2. For the top parameter, enter a register location for the PLC to store the current  
value of the counter as it increments. For example: R001. Then press the Enter key.  
Register R001, used in this example, is not a “retentive” register; it is cleared if power  
goes off. If the current count value should be saved with the power off, use a  
retentive register instead. (R385 - R500)  
3. For the other parameter, enter the counter total. If this should always be the same,  
enter the number. If you want to be able to change the counter total, instead enter a  
register location. The counter total can then be placed in that register by program  
logic, from the Hand-held Programmer or by the programming software (if a  
retentive register is used).  
If you want to change a parameter, press the Enter key. Type in the new value and  
press the Enter key again to accept the new entry.  
4. Enter the other logic required by the Counter:  
A. Logic in the top line to either increment (Up Counter) or decrement (Down Counter)  
the count value. The counter counts each scan that this line has power flow.  
B. Logic in the bottom line to reset to the count total (to 0 for an Up Counter, to the  
maximum value for a Down Counter). If both top and bottom lines are active,  
the counter will be reset.  
C. An output that will be turned On when the Timer reaches the desired value.  
5. Use the Accept (F10) key to add the rung to the program.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-19  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Up Counter  
The Up Counter turns on an output when the count reaches a specified value (from 0 to  
65535 if a register is used to load the counter, or 0 to 32676 if a constant is used). The  
output remains on only as long as the count is equal to the specified value. If the count  
increases past the specified value, the output goes back to 0.  
To program a counter function, enter two inputs (in the example below, I1, and I2), and  
two parameters (R1 and 5 in the example).  
The first input increments the count value. In this example, each time the Positive  
Transition contact transitions on, the count total stored in R1 goes up by 1. The second  
input to the counter resets the count total (here, in R1) to 0. It also deactivates the output  
coil.  
The first parameter of the Up Counter is a register containing a value that is being  
incremented (usually, by an input in the application program). Register R1, used in this  
example, is not a “retentive” register; it is cleared if power goes off. If the current count  
value should be saved with the power off, use a register from R385 to R500.  
The second parameter is the counter total. If this number should always be the same,  
you can enter it directly, as shown in the example. Or, if you want to be able to change  
the counter total, instead enter a register from R385 to R500 as the second parameter for  
the timer (see the example Down Counter).  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-19.  
Example and HHP Instructions  
46128  
Ladder Diagram  
Hand-held Programmer  
I1  
"
C1  
START  
START  
CNTR  
I1  
I2  
R1  
5
F1  
F1  
R1  
UPCTR  
5
I2  
OUT  
C1  
Timing Diagram  
Each time input I1 transitions on, the  
content of register R1 is incremented.  
When it reaches 5, output coil C1  
activates.  
Input I1  
Input I2  
5
Input I2 is used to reset counter R1 to  
0. It also deactivates coil C1.  
4
3
2
Register R1  
1
1
0
0
Coil C1  
GFK-0804B  
4-20  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
DownCounter  
The Down Counter turns on an output when the count reaches zero (from 65535 to 0 if a  
register is used to load the counter, or 32767 to 0 if a constant is used). To program a  
counter function, enter two inputs (in the example below, I1, and I2), and two  
parameters (R2 and R386 in the example).  
The first input decrements the count value. In this example, each time the Positive  
Transition contact transitions on, the count total stored in R1 goes down by 1. The  
second input to the counter resets the count total (here, in R1) to its maximum value. It  
also deactivates the output coil.  
The first parameter of the Down Counter is a register containing the value that is being  
incremented (usually, by an input in the application program). Register R1, used in this  
example, is not a “retentive” register; it is cleared if power goes off. If the current count  
value should be saved with the power off, use a register from R385 to R500.  
The second counter parameter is the counter total. If this number should always be the  
same, you can enter it directly, as shown in the example Up Counter. Or, if you want to  
be able to change the counter total, instead enter a register from R385 to R500 as the  
second parameter for the counter (see the example). The counter total can then be  
placed in that register, either by program logic, or from the Hand-held Progammer or  
programming software.  
When the program encounters a register location as the second parameter of the timer, it  
looks in that register for the value it contains, and uses that value as the timer length. So  
for this example, timing is the same as for the previous example.  
Programming Software Instructions  
If you are using the programming software, refer to the instructions on page 4-19.  
Example and HHP Instructions  
46129  
Ladder Diagram  
Hand-held Programmer  
I1  
"
C2  
START  
START  
CNTR  
I1  
I2  
R2  
R386  
C2  
F1  
F2  
R2  
DNCTR  
R386  
I2  
OUT  
Timing Diagram  
Each time input I1 transitions on, the  
content of register R1 is decremented.  
When it reaches 0, output coil C2  
activates.  
Input I1  
Input I2  
Register R2  
5
5
Input I2 is used to reset counter R2 to  
5. It also deactivates coil C2.  
4
4
3
2
0
1
Coil C2  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-21  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Math Functions  
The Micro PLC instruction set includes these Math functions:  
Addition  
Adds together two numbers and places the total in a specified  
register.  
Subtraction  
The Subtraction function subtracts one number from another  
and places the result in a specified register.  
Multiplication The Multiply function multiplies one number by another and  
places the result in two consecutive registers.  
Division  
The Division function divides one number by another, and  
places the result in two consecutive registers.  
For the Math functions, all numbers are assumed to be positive. There are no negative  
numbers.  
Power flow from a Math function is always true.  
Addition (ADD)  
The Addition function adds together two numbers and places the total in a specified  
register.  
46130  
number  
+
number  
=
register  
The numbers added can be constants, as in the second addition shown on the facing  
page, or the contents of register locations in memory. For example, if R1 contains the  
value 23 and you add the constant 16 to it, then register R3 will contain the value 39.  
Maximum Total  
The maximum total for the Addition function is 65535. If the total exceeds 65535, only  
the excess is placed in the specified register. For example:  
1st number  
2nd number  
Total in register  
50,000  
+
50,000  
=
34464 (excess above 65536)  
The program can compare the total with the two numbers that were added. If the total is  
less than either number, a “rollover” has occurred.  
GFK-0804B  
4-22  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Programming Software Instructions  
1. Select Math/Move (F5).  
2. Select +ADD (F1) from the Math/Move function keys.  
3. Enter the first number to be added. This can be either a constant, or a register  
location that will contain the number to be added. For example: R001. Then press  
the Enter key.  
4. Enter the second number to be added. This can also be a constant or a register  
location. Press the Enter key.  
5. Enter a register location to contain the total. Press the Enter key.  
Examples and HHP Instructions  
46131  
Ladder Diagram  
[R1+R2 ! R3]  
[R1+ 1! R4]  
Hand-held Programmer  
START  
MATH  
I1  
I1  
"
F1  
F1  
R1  
R2  
R3  
OUT  
START  
MATH  
F1 (DROP)  
F1  
R1  
1
R4  
OUT  
F1 (DROP)  
In the first rung of the example above, the Positive Transition contact I1 is used as  
conditional logic to the Addition function. When I1 transitions on, the value in register  
R2 is added to the value in register R1 and the total is placed in register R3.  
In the second rung of the example, there is no contact placed before the Addition  
function. That means it is executed unconditionally. Each program scan, 1 is added to the  
value in R1.  
In this example, since R1 is also one of the parameters of the first Addition function,  
these two rungs of logic work together. Each program scan, the second rung increments  
the value in R1 that is being added to the contents of R2.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-23  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Subtraction (SUB)  
The Subtraction function subtracts one number from another and places the result in a  
specified register.  
46132  
number  
number  
=
register  
The numbers can be constants, as in the first subtraction shown on the facing page, or  
the contents of register locations in memory. For example, if R1 contains the value 100  
and R4 contains the value 57, then register R3 will contain the value 43.  
The second number (the number being subtracted) must be smaller than the first.  
Other wise the content of the specified register will “roll over ” as shown by these  
examples:  
1st number  
2nd number  
Total in register  
100  
0
10  
1
2
=
=
=
90  
65535  
65534  
0
The program should check to be sure that the second number is smaller than the first  
before subtracting.  
Programming Software Instructions  
1. Select Math/Move (F5).  
2. Select –SUB (F2) from the Math/Move function keys.  
3. First, enter the number to be subtracted from. This can be either a constant, or a  
register location that will contain the number. For example: R001. Then press the  
Enter key.  
4. Enter the number to be subtracted. This can also be a constant or a register location.  
Press the Enter key.  
5. Enter a register location to contain the result. Press the Enter key.  
GFK-0804B  
4-24  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Examples and HHP Instructions  
46133  
Ladder Diagram  
Hand-held Programmer  
START  
MATH  
I1  
R1  
5
I1  
"
[R1– 5! R2]  
[R3–R4 ! R5]  
F2  
R2  
OUT  
START  
MATH  
F1  
F2  
R3  
R4  
R5  
OUT  
F1  
In the first rung of the example above, the Positive Transition contact I1 is used as  
conditional logic to the Subtraction function. When I1 transitions on, 5 is subtracted from  
the current value in register R1. The result is placed in register R2.  
In the second rung of the example, there is no contact placed before the Subtraction  
function. That means it is executed unconditionally. Each program scan, the value in R4  
is subtracted from the value in R3. The result is placed in R5.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-25  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Multiplication (MUL)  
The Multiply function multiplies one number by another and places the result in two  
consecutive registers.  
46134  
R1  
x
R2  
=
R3  
R4  
Two registers are needed to accommodate the larger numbers that might possibly result  
from the multiplication. Only the first register (R3 above) is actually specified although  
R3 and R4 will contain the result. Be sure not to use the second register for any other  
purpose in the program.  
The multiplication can be performed on constants or the contents of register locations in  
memory.  
If the result of the multiplication is 65535 or less, it is placed in the higher numbered register  
and the lower numbered register is not used. If your application does not use numbers  
above 65535 for multiplication or division, you do not need to understand how 32-bit  
numbers are handled.  
Examples:  
R1  
R2  
R3  
R4  
10  
100  
1000  
*
*
*
10  
1000  
1000  
=
=
=
00000  
00001  
00015  
00100  
34464  
16960  
(0*65536 + 100)  
(1*65536 + 34464)  
(15*65536 + 16960)  
If you expect the result of the multiplication to be too large to use easily, you can use the  
Division function on the result. See page 4-29.  
Programming Software Instructions  
1. Select Math/Move (F5).  
2. Select *MUL (F3) from the Math/Move function keys.  
3. Enter the first number to be multiplied. This can be either a constant, or a register  
location that will contain the number to be multiplied. For example: R001. Then  
press the Enter key.  
4. Enter the second number to be multiplied. This can also be a constant or a register  
location. Press the Enter key.  
5. Enter the first register of a two register location to contain the result. For example,  
if you entered R003 as shown above, the result of the multiplication would be be  
located in R003 and R004. Press the Enter key.  
If the result of the multiplication is 65535 or less, it is placed in the higher numbered  
register, and the lower numbered register (R003 in the example) is set to 0.  
GFK-0804B  
4-26  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Example and HHP Instructions  
46135  
Ladder Diagram  
Hand-held Programmer  
START  
MATH  
I1  
I1  
"
F1  
F3  
[R1 x R2! R3]  
R1  
R2  
R3  
OUT  
F1  
In the example above, the Positive Transition contact I1 is used as conditional logic to the  
Multiplication function. When I1 transitions on, the value in register R1 is multiplied by  
the value in register R2. The result is placed in registers R3 (specified) and R4.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-27  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Division (DIV)  
The Division function divides one number by another, and places the result in two  
consecutive registers.  
46136  
R1  
B
R3  
=
R4  
R1  
R2  
B
R3  
=
R4  
R5  
The numbers can be either constants or the contents of register locations.  
When this function is programmed, only the first register of a pair is programmed; that  
is, the first register of the pair where the result of the division will be placed, and the first  
register of the number to be divided, (unless it is a constant). Although only the first  
register of a pair is actually specified, it is important not to use the second register for  
any other purpose in the program.  
Examples:  
Whole # Remainder  
R1  
R2  
R3  
R4  
R5  
00000 01000  
00000 01000  
00001 01000  
00010 01000  
/
/
/
/
00010 = 00100 00000 ( 100 plus no remainder)  
00012 = 00083 00004 ( 83 plus 4 remainder)  
00002 = 33268 00000 ( 66536 / 2 = 33268, no remainder)  
01000 = 00656 00360 (( 655360+1000) / 1000) = 656 plus  
remainder of 360)  
00000 01000  
10000 00000  
/
/
03000 = 00000 01000 ( 1000 / 3000 = 0, remainder 1000)  
00010 = 00000 00000 (number is too large to represent as  
a whole number plus a remainder)  
00000 01000  
/
00000 = LAST RESULT (but C1023 turns on to indicate  
that a divide by 0 was incorectly attempted.  
GFK-0804B  
4-28  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Using Division and Multiplication FunctionsTogether  
If a Multiplication produces a result that is too large to use easily (the results are greater  
than 65535, and occupy two registers), you can divide the Multiplication result to scale  
the result to use smaller numbers.  
For example:  
46137  
R100  
1000  
R101  
1000  
R102 R103  
00015 16960  
=
x
Multiply:  
= 15*65536 + 16960 = 1,000,000  
R102  
R103  
R104  
1000  
R105  
R106  
=
Divide:  
00015 16960  
1,000,000  
01000 00000  
/
/
1000  
=
1000 with no remainder  
In this example, R105 would contain the whole number result of the division, and R106  
would contain the remainder.  
Programming Software Instructions  
1. Select Math/Move (F5).  
2. Select /DIV (F4) from the Math/Move function keys.  
3. First, enter the number to be divided. This can be either a constant, or a two-register  
location that will contain the number to be added. For example: R001 above  
represents the two-register location R001 and R002. Press the Enter key.  
4. Enter the number to divide by. This can also be a constant or a one-register location.  
Press the Enter key.  
5. Enter the first register of a two register location to contain the result. For example,  
if you entered R004 as shown above, the result of the division would be be located in  
R004 and R005. Press the Enter key.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-29  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Move Functions  
The Micro PLC instruction set includes these Math functions:  
Move  
The Move function copies 1 word (16 bits) of data to a speci-  
fied memory location.  
Block Move  
The Block Move function copies a selectable amount of data to  
a specified memory location. It copies more than 16 bits at a  
time.  
Indirect Move The Indirect Move function copies a constant or the content of  
register to a variable register location.  
Move  
The Move function copies 1 word (16 bits) of data to a specified memory location. The  
possible choices are:  
Register > Register  
Input (I) > Register  
Register > Coil (C)  
Coil (C) > Register  
Register > Output (O)  
Programming Software Instructions  
1. Select Move (F5) from the Math/Move function keys.  
2. Enter the number to be moved. This can be a constant, or the contents of a specified  
bit or register memory location. In the example shown, the Move function copies 16  
bits located from I001 through I016. Then press the Enter key.  
3. Enter a memory location for the data to be copied to. The memory type (bit or  
register) must be compatible with the data being moved. Press the Enter key. The  
software will not let you select an incompatible memory type.  
GFK-0804B  
4-30  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Examples and HHP Instructions  
46138  
Ladder Diagram  
Hand-held Programmer  
START  
MOVE  
I1  
R1  
R2  
I1  
"
F1  
F1  
[R1! R2]  
OUT  
START  
MOVE  
F1  
F1  
F1  
[I1! R3]  
I1R3  
OUT  
In the first example rung above, a transitional contact controls execution of a Move  
function. That Move function copies the contents of register R1 to register R2.  
The second example rung has no conditional logic; it executes each program scan. That  
Move function copies 16 bits from I1 to I16 into register R3.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-31  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Block Move  
The Block Move function copies a selectable amount of data to a specified memory location.  
It works like a Move function, except that it copies more than 16 bits at a time. The options  
are explained below:  
Option  
Example  
Description  
Register > Register  
R001 0002 > R004  
Copies the contents of R001–R002  
into R004–R005.  
R010 R020 > R100 Copies the contents of R010 to R100 in  
incremental order, according to the  
length specified in R020. For example,  
if R020 contained the number 2, then  
the contents of R010–R011 would be  
copied onto R100–R101.  
Coil (C) > Coil (C)  
C001 0010 > C014 Copies Internal Relay status coils  
C001–C010 into C014–C023.  
Output (O) > Output (O)  
Input (I) > Output (O)  
Input (I) > Coil (C)  
O001 0016 >O033 Copies 16 output bits from  
O001–O016 into O033–O048.  
I004 0016 > O033 Copies 16 input bits (I001–I019) into  
outputs O033–O048.  
I016 0006 > C020 Copies 6 input bits (I016–I011) into  
internal coils C010–C025.  
Coil (C) > Output (O)  
C001 0010 > O003 Copies 10 bits from internal coils  
C001–C010 into outputs  
O003–O012.  
Programming Software Instructions  
1. Select B–Move (F6) from the Math/Move function keys.  
2. Enter the number to be moved. This can be a constant, or the contents of a specified  
memory location (see above). For example: R001. Then press the Enter key.  
3. Enter the data length. This can be a constant or the contents of a specified register  
location. The number may represent either bits or words of data, according to the  
data type being moved.  
4. Enter a memory location to contain the result. Press the Enter key.  
GFK-0804B  
4-32  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Examples and HHP Instructions  
46139  
Ladder Diagram  
Hand-held Programmer  
START  
MOVE  
I1  
R1  
5
I1  
"
L
[R1E 5! R10]  
F2  
N
R10  
L
OUT  
START  
MOVE  
[O9E 8! O17]  
F1  
F2  
N
O9  
8
O17  
OUT  
F1  
In the first example rung above, when transitional contact I1 goes on, 5 registers (R1 –  
R5) are copied to locations R10 – R14.  
In the second rung, each program scan 128 bits (8 x 16) are copied from O9 – O137 to  
locations O17 – O124. Since the locations being copied from overlap the locations being  
copied into, this function actually has the effect of shifting 128 bits eight bits to the “left”  
(that is, to higher locations) in memory.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-33  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Indirect Move  
The Indirect Move function copies a constant or the content of register to a variable  
register location. The first part of this function specifies the data to be copied. The second  
part is a register that points to the actual register where the data will be placed. This  
allows the register where the data is placed to be changed as required for the program.  
In the example on the facing page, an Indirect Move function copies the content of  
register R002 into a register which is pointed to by register R003. During one program  
scan, R003 might point to register R020. In another scan, it might point to register R021.  
Specifying a Location in the Pointer Register  
Ordinarily, the variable register for an Indirect Move function is placed into the pointer  
register by a Move instruction in the application program. It is also possible to enter a  
location from the programmer, however.  
In either case, enter the number of any register from R001 to R500.  
Example:  
46140  
[ R1 ! @R20 ]  
R1  
2162  
!
@R20  
385  
R385  
2162  
Programming Software Instructions  
1. Select I–Move (F7) from the Math/Move function keys.  
2. Enter the number to be moved. This can be a constant, or the contents of a specified  
memory location (see above). For example: R001. Then press the Enter key.  
3. Enter a memory location to contain the result. Press the Enter key.  
GFK-0804B  
4-34  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Examples and HHP Instructions  
46141  
Ladder Diagram  
Hand-held Programmer  
START  
MOVE  
I1  
5
R1  
I1  
"
F1  
F3  
[ 5! @R1]  
OUT  
START  
MOVE  
F1  
F3  
F1  
[R2 ! @R3]  
R2  
R3  
OUT  
In the first example rung above, an Indirect Move function copies the constant 5 into a  
register pointed to by R1. During one program scan, R1 might point to register R20. In  
another scan, it might point to register R21.  
The second example rung has no conditional logic; each program scan, it copies the  
content of register R2 to a register which is pointed to by register R3.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-35  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Compare Functions  
The Compare functions are used to compare the contents of two registers. They can be  
used to activate an output, or as conditional logic to other program functions.  
The Micro PLC Instruction Set includes these Compare functions:  
Equal  
Greater  
Less  
Passes power flow to the right in the rung if the contents of  
the two registers are equal.  
Passes power flow to the right in the rung if the number in the  
first register is greater than the number in the second.  
Passes power flow to the right in the rung if the number in the  
first register is less than the number in the second.  
Greater or  
Equal  
Passes power flow to the right in the rung if the number in the  
first register is greater than or equal to the number in the se-  
cond.  
Less or Equal  
Not Equal  
Passes power flow to the right in the rung if the number in the  
first register is less than or equal to the number in the second.  
Passes power flow to the right in the rung if the number in the  
first register is not the same as the number in the second.  
An output in the same rung will be set to 1 when the condition being tested for is met.  
Examples  
46142  
Ladder Diagram  
O17  
Equal  
Greater  
Less  
Output O17 is activated when  
contents of R1 = 5.  
[R1 = 5]  
O18  
Output O18 activated when con-  
tent of R1 is greater than content  
of R2.  
[R1 > R2]  
[R3 < R4]  
[R4 > R6]  
O19  
O20  
Output O19 activated when con-  
tent of R3 is less than content of  
R4.  
Output O20 activated when con-  
tent of R4 is greater than or equal  
to content of R6.  
Greater or  
Equal  
O21  
O22  
Less or  
Equal  
Output O21 activated when con-  
tent of R7 is less than or equal to  
content of R8.  
[R7 < R8]  
Not Equal  
Output O22 activated when con-  
tent of R9 is not equal to content  
of R10.  
[R9 0 R10]  
GFK-0804B  
4-36  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Programming Software Instructions  
Select Compare (F6), then use the assigned function key(s) to select a Compare function:  
= .EQ. (F1)  
, .NE. (F2)  
> .GT. (F3)  
< .LT. (F4)  
> .GE. (F5)  
< .LE. (F6)  
Equal  
Not Equal  
Greater Than  
Less Than  
Greater Than or Equal  
Less Than or Equal  
1. Enter the first value to be compared. It can be a constant or the contents of a  
register. Then press the Enter key.  
2. Enter the second value to be compared. This also can be a constant or the contents  
of a register. Press the Enter key.  
3. Press Enter to add the function to the program.  
Compare functions often are used in combination with output coils as shown below.  
In this example, Output O022 is turned on when the content of register R009 is not equal  
to the constant 10.  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-37  
Download from Www.Somanuals.com. All Manuals Search And Download.  
4
Logic Operations  
The Micro PLC Instruction Set includes these Logic operations:  
Word AND  
The AND function compares each bit in one register against  
each bit in another. If both bits are 1, it places a 1 in the corre-  
sponding bit of a third register.  
Inclusive OR  
Exclusive OR  
The Inclusive OR function compares each bit in one register  
against each bit in another. If either or both bits are 1, it places a  
1 in the corresponding bit of a third register.  
The XOR function compares each bit in one register against  
each bit in another. If both bits are the same (1 or 0), it places a  
0 in the corresponding bit of a third register  
Shift Register Shift Register Right shifts all the bits in a register to the right  
Right  
(toward the least significant bits) by a specified number of  
positions.  
Shift Register Shift Register Left shifts all the bits in a register to the rleft (to-  
Left  
ward the most significant bits) by a specified number of posi-  
tions.  
NOT  
The NOT function takes the opposite state of each bit in a regis-  
ter and places it into a second register.  
GFK-0804B  
4-38  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Word AND  
The AND function compares each bit in the first specified register against each  
corresponding bit in the second specified register. If both bits are 1, it places a 1 in the  
corresponding bit of the third register. If either or both of the corresponding bits is 0, the  
AND function places a 0 in the corresponding location in the third register.  
Example:  
46143  
R1  
(170)  
(15)  
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
AND  
R2  
R3  
(10)  
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
Programming Software Instructions  
1. Select Logic (F7)  
2. Select AND (F1) from the Logic function keys.  
3. Enter the register location of the first number to be ANDed. Press the Enter key.  
4. Enter the register location of the second number to be ANDed. Press the Enter key.  
5. Enter a register for the result AND to be placed in. Press the Enter key.  
Example and HHP Instructions  
46144  
Ladder Diagram  
Hand-held Programmer  
START  
LOGIC  
A
R1  
R2  
R3  
F1  
F2  
[ R1 N R2! R3]  
D
OUT  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-39  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Inclusive OR (IOR)  
The Inclusive OR function compares each bit in the first specified register against each  
corresponding bit in the second specified register. If either or both bits are 1, it places a 1 in  
the corresponding bit of the third register. If both of the corresponding bits is 0, the OR  
function places a 0 in the corresponding location in the third register.  
Example:  
46145  
R1  
(170)  
(15)  
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
OR  
R2  
R3  
(10)  
0
0
0
0
0
0
0
0
1
0
1
0
1
1
1
1
Programming Software Instructions  
1. Select Logic (F7)  
2. Select IOR (F2) from the Logic function keys.  
3. Enter the register location of the first number to be IORed. Press the Enter key.  
4. Enter the register location of the second number to be IORed. Press the Enter key.  
5. Enter a register for the result to be placed in. Press the Enter key.  
Example and HHP Instructions  
46146  
Ladder Diagram  
Hand-held Programmer  
START  
LOGIC  
I
R1  
R2  
R3  
F2  
F1  
[ R1 O R2! R3]  
R
OUT  
GFK-0804B  
4-40  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
ExclusiveOR (XOR)  
The XOR function compares each bit in the first specified register against each  
corresponding bit in the second specified register. If both bits are the same (1 or 0), it  
places a 0 in the corresponding bit of the third register. If the bits are different, it places a  
1 in the corresponding location in the third register.  
Example:  
46147  
R1  
(170)  
(15)  
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
1
1
0
1
1
1
0
1
XOR  
R2  
R3  
(165)  
0
0
0
0
0
0
0
0
1
0
1
0
0
1
0
1
Programming Software Instructions  
1. Select Logic (F7)  
2. Select XOR (F3) from the Logic function keys.  
3. Enter the register location of the first number to be XORed. Press the Enter key.  
4. Enter the register location of the second number to be XORed. Press the Enter key.  
5. Enter a register for the result to be placed in. Press the Enter key.  
Example and HHP Instructions  
46148  
Ladder Diagram  
Hand-held Programmer  
START  
LOGIC  
X
R1  
R2  
R3  
F3  
F1  
[ R1 O R2! R3]  
R
OUT  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-41  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Shift Register Right  
Each scan that power flow is received, the Shift Register Right function shifts all the bits  
in a register to the right (toward the least significant bits). The number of positions to be  
shifted is provided in the functions second register (R2 in the example above).  
The data is copied to the register specified (R3 in the example above). The original data is  
not altered. In the copied data, the specified number of bits is “shifted out” on the right,  
and a corresponding number of zeros is moved in on the left.  
Example:  
For this example, if the second register (R2) contained the value 3, the bits would be  
shifted right by 3 positions:  
46149  
(250)  
0
0
0
0
0
0
0
0
1
0
1
0
1
0
1
1
1
1
0
1
1
1
0
1
R1  
SHR  
0
0
0
0
0
0
0
0
R3  
(31)  
Entering the Number of Positions to Shift  
The best way to enter the number of positions for the shift into the second register is  
with a Move command in the application program. Alternatively, you could use the  
programmer to manually place the number into a retentive register (R385 – R500).  
Programming Software Instructions  
1. Select Logic (F7)  
2. Select SH–REG RIGHT (F5) from the Logic function keys.  
3. Enter the register location of the data to be shifted right. Press the Enter key.  
4. Enter the register location for the number of bits to shift. Press the Enter key.  
5. Enter a register for shifted data to be placed in. Press the Enter key.  
Example and HHP Instructions  
46150  
Ladder Diagram  
Hand-held Programmer  
START  
LOGIC  
I1  
F1  
S
I1  
"
MoreMENU  
F2  
[ R1 H R2! R3]  
R1  
R2  
R3  
R
F1  
OUT  
GFK-0804B  
4-42  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
Shift Register Left  
Each scan, the Shift Register Left function shifts all the bits in a register to the left (that is,  
toward the most significant bit). The number of positions to be shifted is provided in the  
functions second register (R2 in the example above).  
The data is copied to the register specified (R3 in the example above). The original data is  
not altered. In the copied data, the specified number of bits is “shifted out” on the left,  
and a corresponding number of zeros is moved in on the right.  
Example  
For this example, if the second register (R2) contained the value 1, the bits would be  
shifted left by 1 position:  
46151  
0
0
0
0
0
0
0
0
1
1
1
1
1
0
1
0
(250)  
R1  
SHL  
(500)  
0
0
0
0
0
0
0
1
1
1
1
1
0
1
0
0
R3  
Entering the Number of Positions to Shift  
The best way to enter the number of positions for the shift into the second register is  
with a Move command in the application program. Alternatively, you could use the  
programmer to manually place the number into a retentive register.  
Programming Software Instructions  
1. Select Logic (F7)  
2. Select SH–REG LEFT (F6) from the Logic function keys.  
3. Enter the register location of the data to be shifted left. Press the Enter key.  
4. Enter the register location for the number of bits to shift. Press the Enter key.  
5. Enter a register for shifted data to be placed in. Press the Enter key.  
Example and HHP Instructions  
46152  
Ladder Diagram  
Hand-held Programmer  
START  
LOGIC  
I1  
F1  
S
I1  
"
MoreMENU  
F3  
[ R1 H R2! R3]  
R1  
R2  
R3  
L
F1  
OUT  
GFK-0804B  
Chapter 4 The Micro PLC Instruction Set  
4-43  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
4
NOT  
The NOT function takes the opposite state of each bit in the first specified register and  
places it into the second register.  
Example:  
46153  
R1  
(234)  
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
1
0
1
0
1
0
0
1
1
0
0
1
1
0
0
1
NOT  
R2  
(65301)  
Programming Software Instructions  
1. Select Logic (F7)  
2. Select NOT (F4) from the Logic function keys.  
3. Enter the register location of the first number to be NOTed. Press the Enter key.  
4. Enter the register location of the second number to be NOTed. Press the Enter key.  
5. Enter a register for the result to be placed in. Press the Enter key.  
Example and HHP Instructions  
46154  
Ladder Diagram  
Hand-held Programmer  
START  
LOGIC  
I1  
F1  
N
[ R1 O R2]  
T
I1  
"
MoreMENU  
F1  
R1  
R2  
F1  
OUT  
GFK-0804B  
4-44  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Appendix A Using Directories  
A
This section gives some advice on organizing the Micro PLC programming directory structure  
on your hard disk.  
If you installed the programming software using the default values, the programming files  
are in a directory named \ MICROon your disk. You also have the following directories:  
\ MICRO  
MICRO.EXE  
the programming software  
MICRO.CFG  
a configuration file that contains information about  
your serial port, display, and data tables format.  
\ COMM  
\ DDE  
Loading and Saving Files  
When using the Load or Save command, you need to enter a filename. You can either:  
A. Enter a filename without a path:  
PROG1  
In this case, PROG1 is assumed to be in the present directory. If you started running  
MICRO.EXE in the \ MICRO directory, the file PROG1 is really assumed to be  
C:\ MICRO\ PROG1e, tc...  
OR:  
B. Enter a path with the filename:  
C:\ MICRO\ RIVETER\ PROG1  
When you specify the entire filename including drive, directories, and filename, it  
doesnt make any difference which directory you are in when you Load and Save.  
A-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
A
Using the Change Directory Function  
Most of the time, you wont need to use the Change Directory function. The Change  
Directory function is normally used to change the default directory for Load and Save file  
commands. This is useful if you repeatedly need to load or save from a diskette, or if you  
need to repeatedly load or save from a directory that you didnt start running MICRO from.  
Even if you dont use the Change Directory function, you can still load and save from  
other directories. You will need to type in the entire path name for the file.  
For example,ifyou have“changed directoriestoC:\ MISC\ OTHER\ STUFF, when you  
save a file, the typed filename would be:  
TESTFILE.PLC  
If you have not changed directories, the typed filename would be:  
C:\ MISC\ OTHER\ STUFF\ TESTFILE.PLC  
The MICRO.CFG File  
Whenever you Save configuration in the Setup menu, a MICRO.CFG file is written to  
the current directory. If you are in the \ MICRO directory, MICRO.CFG is written there. If  
you are in another directory, then MICRO.CFG is written there instead. You can have as  
many MICRO.CFG files as you want, but each must be in a separate directory.  
The MICRO.CFG file contains information about the video characteristics of your  
computer and your serial port. It also contains the format of your online data displays.  
This file is manually loaded from the current directory when you use the Restore  
function from the Setup menu. It is automatically loaded when you start up the  
programming software from a directory which has a resident MICRO.CFG file.  
Hints for a Basic Application  
If you will not be creating a large number of programs, or if you dont want to use  
directories, start up the software by entering:  
C:>CD \ MICRO  
C:\ MICRO>MICRO  
When you start the software in this way, the MICRO.CFG file (configuration file) that is  
already saved in the \ MICRO directory is used to set the video mode, serial port  
selection, and online data display format. You can change the format at any time, then  
Save the new format.  
When in the Disk menu, you can use Load and Save to the present directory(\ MICRO),  
and not need to change directories. If you want to save a file to diskette or load a file  
from diskette, enter the diskette drive name as part of the filename. For example:  
A:1STPROG.PLC  
GFK-0804B  
A-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
A
Hints for an Advanced Application  
If you plan to create a large number of Micro PLC programs, it makes sense to create  
separate directories with a separate program or group of related programs in each. This  
is a convenient way to keep track of your files.  
Also, you then have the capability of saving a different online data display format for  
each directory. This can be useful if you have a specific online data display related to a  
program. For example, you may want to use multiple online windows, with a specific  
reference at the start of each window. The procedure would be:  
1. From DOS, create directories to the \ MICRO directory using the MD command. For  
example:  
C:>MD\ MICRO\ PALLET  
C:>MD\ MICRO\ RIVETER  
C:>MD\ MICRO\ TRANSFER  
2. Then, go to the directory which has the program to be edited before starting the  
programming software.  
C:>CD\ MICRO\ PALLET  
C\: MICRO\ PALLET> MICRO  
3. Create the new program (for example: PALLET1.PLC) and save it to disk.  
4. Set up the online data display format for the program.  
5. Go to the Setup menu and Save this configuration. This puts a MICRO.CFG file with  
the present online data display format in the directory you are now in  
(C:\ MICRO\ AP LLET in this example).  
6. Now, every time you start up the software as shown in step 2 above, the online data  
display you created for that program is used automatically.  
7. Similarly, you could create unique data displays for each directory.  
If you set up your system in this manner, you can change from one directory to another  
in either of the following ways:  
A. Exit from the programming software, change to the \ MICRO\ RIVETER directory  
and type MICRO. This will automatically load the \ RIVETER online data display  
format, and allow you to directly Load and Save the RIVETER files.  
B. Use the Change Directory function from the Disk menu to get to the \ RIVETER  
directory. This allows you to Load and Save the RIVETER files, but you need to  
separately Restore the online data display format from the Setup menu.  
GFK-0804B  
Appendix A Using Directories  
A-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Appendix B MicroPLC Protocol  
section level 1 1  
figure_ap level 1  
table_ap level 1  
B
The information in this appendix is provided only for advanced users requiring  
communications between the Micro PLC and a host system.  
Communications Files  
Memory Types and Addresses  
I/ OMemory Addresses  
Work Memory  
Program and I/ O Address Map  
Communications Protocol  
Data Format  
Read Discretes  
Read Analogs  
Read Program Memory  
Write Discretes  
Write Analogs  
Write Program Memory  
Read Status  
Start Program  
Stop Program  
Status Word  
Error Reply  
Communications Functions  
Microsoft C (Large Model: Compile w/ -AL Option)  
Microsoft C (Small Model: Compile w/ -AS Option)  
Turbo C (Large Model: Compile w/ -ml Option)  
Turbo C (Small Model: Compile w/ -ms Option)  
IBM Compiler BASIC  
Sample Programs  
B-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
B
Communications Files  
The programming software diskette contains the following communications drivers and  
demonstration programs. If you used the automated install routine for the  
Programming software, these files were placed in the \ comm subdirectory under the  
main/ microdirectory.  
These files are provided “as is”. Please do not call for technical support on these files.  
This is driver code in Turbo C/ C++, which can be used to  
communicate with the Micro PLC. This file should generally be  
included in other C files that perform the data acquisition.  
MCROCOMM.C  
This is source code which shows a simple application of the  
MCROCOMM.C driver written in Turbo C.  
DEMO1.C  
The executable form of the DEMO1.C file. Try this as is before  
modifying and recompiling.  
DEMO1.EXE  
COMPILE1.BAT  
This is a simple BAT file to compile the DEMO1.C file under  
Turbo C. You may need to modify the TCC command line to  
account for differences in your hard drive and compiler file  
locations.  
This is source code for a more complicated application. This file  
also “includes” MCROCOMM.C at compile time.  
MICROBAR.C  
MICROBAR.EXE  
COMPBAR.BAT  
This is the executable file for MICROBAR.C. Try this before  
making changes, and recompiling.  
This batch file compiles MICROBAR.C. It has two command line  
switches. Print out the file to see. The TCC command line may  
need to be modified to account for your hard drive and  
compiler file locations.  
These files are used by the COMPBAR.BAT file.  
OPT??.RES  
EGAVGA.OBJ  
This is a video driver for EGA and VGA modes. This is used by  
the COMPBAR batch file during compilation.  
GFK-0804B  
B-2  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
CommunicationsMemory Types and Addresses  
I/O Memory Addresses  
Type  
Code  
I
Max  
256  
Address Range (hex)  
0000 – 00FF  
DiscreteInput  
Discrete Output  
O
256  
0100 – 01FF  
Forced Discrete Input  
Forced Discrete Output  
Internal Coil  
256  
0200 – 02FF  
FI  
256  
0300 – 03FF  
FO  
C
1024  
0400 – 07FF  
Registers  
(includes the next two items)  
AnalogInput  
AnalogOutput  
IR  
OR  
256  
0000 – 01FE *  
0200 – 03FE *  
InternalRegisters  
0400 – 07FE *  
R
512  
*
Byte address with Least Significant Bit always 0.  
Special Registers  
Registers 501 to 512 are reserved. Registers 510 to 512 are used for communications setup.  
Register  
Function  
Description  
Protocol  
0 = Micro PLC (default)  
1 = RTU  
510  
Station Address  
Baud rate  
1 (default) to 247  
511  
512  
0 = 300  
1 = 600  
2 = 1200  
3 = 2400  
4 = 4800  
5 = 9600  
Communications Parameters  
Baud Rate  
Data Bits  
Stop Bit  
Parity  
9600 (default)  
8
1
None  
GFK–0804B  
Appendix B Micro PLC Protocol  
B-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
CommunicationsProtocol  
This is the low level definition of the serial communications Protocol. A driver for the  
most commonly used portions of the protocol has already been written for C, and  
compiler Basic. This driver is contained in the MCROCOM.C file from the distribution  
diskette. Sample C programs which use this driver are provided. Refer to the  
MCROCOMM.C file and examples in the \ COMM subdirectory of your disk.  
DLE STX data1 data2 ... DLE ETX cc  
DLE = 16  
STX =  
ETX =  
2
3
data N – Data byte. If the data is equal to DLE (16), two DLE bytes will be transmitted.  
Maximum of 255 data bytes (excluding DLE bytes that were inserted).  
cc  
– Checksum byte. 2s complement of 8 bit sum of data bytes only (excluding DLE  
bytes that were inserted and the DLE/ STX DLE/ ETX).  
Data Format  
NOTES:  
Alladdresses are in the range of 11 bits. Most significant 5 bits are 0s.  
Bit values are packed into bytes (byte 0 bit 0, byte 0 bit 1, ..., byte 1 bit 0, etc.).  
Analog values, addresses, and program words are 2 bytes each, MSB first.  
PLC id value is ignored by the programming port, but it shouldnt be dropped.  
Program write can be done only when the PLC is in Program mode (stopped).  
When downloading a program in more than one block, the blocks must be in  
ascending address order.  
Read Discretes  
ID 01 count addr_high addr_low  
Reply:  
ID 01 count addr_high addr_low data1 data2 ...  
ID  
– PLC ID number  
count  
– number of bits (discretes) to read  
High byte of address of the first discrete to read  
– Low byte of address of the first discrete to read  
– Data read  
addr_high  
addr_low  
dataN  
GFK-0804B  
B-4  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
Read Analogs  
ID 02 count addr_high addr_low  
Reply:  
ID 02 count addr_high addr_low data1 data2 ...  
ID  
– PLC ID number  
count  
– number of words (registers) to read  
High byte of address of the first register to read  
– Low byte of address of the first register to read  
– Data read  
addr_high  
addr_low  
dataN  
Read Program Memory  
ID 03 count addr_high addr_low  
Reply:  
ID 03 count addr_high addr_low data1 data2 ...  
ID  
– PLC ID number  
count  
– number of instruction words to read  
High byte of address of the first instruction to read  
– Low byte of address of the first instruction to read  
– Data read  
addr_high  
addr_low  
dataN  
Write Discretes  
ID 04 count addr_high addr_low data1 data2 ...  
Reply:  
ID 04 count addr_high addr_low  
ID  
– PLC ID number  
count  
– number of bits (discretes) to write  
High byte of address of the first discrete to write  
– Low byte of address of the first discrete to write  
– Data to write  
addr_high  
addr_low  
dataN  
Write Analogs  
ID 05 count addr_high addr_low data1 data2 ...  
Reply:  
ID 05 count addr_high addr_low  
ID  
– PLC ID number  
count  
– number of words (registers) to write  
High byte of address of the first register to write  
– Low byte of address of the first register to write  
– Data to write  
addr_high  
addr_low  
dataN  
GFK–0804B  
Appendix B Micro PLC Protocol  
B-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
B
Write Program Memory  
ID 06 count addr_high addr_low data1 data2 ...  
Reply:  
ID 06 count addr_high addr_low  
ID  
– PLC ID number  
count  
– number of instruction words to write  
High byte of address of the first instruction to write  
– Low byte of address of the first instruction to write  
– Data to write  
addr_high  
addr_low  
dataN  
Read Status  
ID 07  
Reply:  
ID 07 stat_high stat_low pgm_siz_h pgm_siz_l mod0 mod1 ... mod13  
ID  
– PLC ID number  
stat_high  
stat_low  
pgm_siz_h  
pgm_siz_l  
modN  
High byte of status word  
– Low byte of status word  
High byte of program size (in words)  
– Low byte of program size  
Type of module in slot N. It may be:  
0
1
2
– not installed  
– 24VDC Input 16 pts  
– 115VAC Relay Output 8 pts  
Status Word:  
bits 0 – 7 are for fatal conditions (stopping the PLC)  
bits 8 – 11 are for non-fatal conditions  
bit 15 is informational  
0
memory is corrupted  
1
invalid program  
2
3
invalid instruction encountered  
(runtime error (such as Indirect Move to invalid address)  
reserved  
4 – 6  
7
8
forced stop (PLC stopped by error or by programmer)  
I/ Oproblem  
9
system timer malfunction  
reserved  
Program mode (1 if in Program mode)  
10 – 14  
15  
GFK-0804B  
B-6  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
B
Start Program  
ID 08  
Reply:  
ID 08 stat_high stat_low  
stat_high  
stat_low  
High byte of status word  
– Low byte of status word  
Status Word:  
bits 0 – 7 are for fatal conditions (stopping the PLC)  
bits 8 – 11 are for non-fatal conditions  
bit 15 is informational  
0
memory is corrupted  
1
invalid program  
2
3
invalid instruction encountered  
(runtime error (such as Indirect Move to invalid address)  
reserved  
4 – 6  
7
8
forced stop (PLC stopped by error or by programmer)  
I/ Oproblem  
9
system timer malfunction  
reserved  
Program mode (1 if in Program mode)  
10 – 14  
15  
Stop Program  
ID 09  
Reply:  
ID 09 stat_high stat_low  
stat_high  
stat_low  
High byte of status word  
– Low byte of status word  
Error Reply  
ID 8x error_code  
8x is the command code to which this is the reply plus 128 (80h).  
error codes:  
1
2
3
4
5
6
7
8
Receive buffer overflow  
Checksum error  
Illegal command code  
Illegal command format  
Block size too big or zero  
Cannot modify program while running  
Cannot run while switch is in PROG position  
Address out of range  
GFK–0804B  
Appendix B Micro PLC Protocol  
B-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
B
Communications Functions  
The MCROCOMM.C file contains a driver that implements the following functions. Note that a driver  
function is not available for every feature supported by the underlying protocol.  
Microsoft C (Large Model: Compile w/ -AL Option)  
Function  
Call  
Inputs  
: Read Register  
: int  
: int  
int  
MCL_Rreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 0–IR, 1–OR, 2–R  
/ * Adrs. of the 1st register to read  
/ * Number of words to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
: Write Register  
: int  
MCL_Wreg (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 1–OR, 2–R  
/ * Adrs. of the 1st register to write  
/ * Number of words to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
: int  
Return  
True/ False  
Function  
Call  
: Read Bit  
: int  
MCL_Rbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
: char  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 0–DI, 1–DO, 4–C  
/ * Adrs. of the 1st discrete to read  
/ * Number of bits to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
Return  
True/ False  
Function  
Call  
Inputs  
: Write Bit  
: int  
: int  
int  
int  
int  
MCL_Wbit (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 1–DO, 4–C  
/ * Adrs. of the 1st discrete to write  
/ * Number of bits to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
count;  
*buf;  
char  
Return  
True/ False  
GFK-0804B  
B-8  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
Microsoft C (Small Model: Compile w/ -AS Option)  
Function  
Call  
Inputs  
: Read Register  
: int  
: int  
int  
MCS_Rreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 0–IR, 1–OR, 2–R  
/ * Adrs. of the 1st register to read  
/ * Number of words to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
Inputs  
: Write Register  
: int  
: int  
int  
MCS_Wreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 1–OR, 2–R  
/ * Adrs. of the 1st register to write  
/ * Number of words to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
: Read Bit  
: int  
MCS_Rbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 0–DI, 1–DO, 4–C  
/ * Adrs. of the 1st discrete to read  
/ * Number of bits to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
Return  
: char  
True/ False  
Function  
Call  
: Write Bit  
: int  
MCS_Wbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
char  
True/ False  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 1–DO, 4–C  
/ * Adrs. of the 1st discrete to write  
/ * Number of bits to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
Return  
GFK–0804B  
Appendix B Micro PLC Protocol  
B-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
Turbo C (Large Model: Compile w/ -ml Option)  
Function  
Call  
Inputs  
: Read Register  
: int  
: int  
int  
TCL_Rreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 0–IR, 1–OR, 2–R  
/ * Adrs. of the 1st register to read  
/ * Number of words to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
Inputs  
: Write Register  
: int  
: int  
int  
TCL_Wreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 1–OR, 2–R  
/ * Adrs. of the 1st register to write  
/ * Number of words to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
: Read Bit  
: int  
TCL_Rbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 0–DI, 1–DO, 4–C  
/ * Adrs. of the 1st discrete to read  
/ * Number of bits to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
Return  
: char  
True/ False  
Function  
Call  
: Write Bit  
: int  
TCL_Wbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
char  
True/ False  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 1–DO, 4–C  
/ * Adrs. of the 1st discrete to write  
/ * Number of bits to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
Return  
GFK-0804B  
B-10  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
Turbo C (Small Model: Compile w/ -ms Option)  
Function  
Call  
Inputs  
: Read Register  
: int  
: int  
int  
TCS_Rreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 0–IR, 1–OR, 2–R  
/ * Adrs. of the 1st register to read  
/ * Number of words to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
Inputs  
: Write Register  
: int  
: int  
int  
TCS_Wreg (port, memtype, addr, count, buf);  
port;  
memtype;  
addr;  
/ * 0–COM1, 1–COM2  
/ * 1–OR, 2–R  
/ * Adrs. of the 1st register to write  
/ * Number of words to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
int  
int  
: int  
count;  
*buf;  
Return  
True/ False  
Function  
Call  
: Read Bit  
: int  
TCS_Rbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 0–DI, 1–DO, 4–C  
/ * Adrs. of the 1st discrete to read  
/ * Number of bits to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
Return  
: char  
True/ False  
Function  
Call  
: Write Bit  
: int  
TCS_Wbit (port, memtype, addr, count, buf);  
Inputs  
: int  
int  
int  
int  
char  
True/ False  
port;  
memtype;  
addr;  
count;  
*buf;  
/ * 0–COM1, 1–COM2  
/ * 1–DO, 4–C  
/ * Adrs. of the 1st discrete to write  
/ * Number of bits to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
Return  
GFK–0804B  
Appendix B Micro PLC Protocol  
B-11  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
IBM Compiler BASIC  
Function  
Call  
: Read Register  
: int  
BASRreg (port%, memtype%, addr%, count%, buf%(0),  
status%);  
Inputs  
Return  
: int  
int  
int  
int  
: int  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
status;  
/ * 0–COM1, 1–COM2  
/ * 0–IR, 1–OR, 2–R  
/ * Adrs. of the 1st register to read  
/ * Number of words to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
*/  
/ * Error status–0: Normal  
Function  
Call  
: Write Register  
: int  
BASWreg (port%, memtype%, addr%, count%, buf%(0),  
status%);  
Inputs  
: int  
int  
int  
int  
: int  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
status;  
/ * 0–COM1, 1–COM2  
/ * 1–OR, 2–R  
/ * Adrs. of the 1st register to write  
/ * Number of words to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
*/  
Return  
/ * Error status–0: Normal  
Function  
Call  
: Read Bit  
: int  
BASRbit (port%, memtype%, addr%, count%, buf$,  
status%);  
Inputs  
: int  
int  
int  
int  
: char  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
status;  
/ * 0–COM1, 1–COM2  
/ * 0–DI, 1–DO, 4–C  
/ * Adrs. of the 1st discrete to read  
/ * Number of bits to read  
/ * Data read  
*/  
*/  
*/  
*/  
*/  
*/  
Return  
/ * Error status–0: Normal  
Function  
Call  
: Write Bit  
: int  
BASWbit) (port%, memtype%, addr%, count%, buf$,  
status%);  
Inputs  
: int  
int  
int  
int  
char  
int  
port;  
memtype;  
addr;  
count;  
*buf;  
status;  
/ * 0–COM1, 1–COM2  
/ * 1–DO, 4–C  
/ * Adrs. of the 1st discrete to write  
/ * Number of bits to write  
/ * Data to write  
*/  
*/  
*/  
*/  
*/  
*/  
Return  
/ * Error status–0: Normal  
GFK-0804B  
B-12  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
Sample Programs  
Sample C Program for Turbo C/C++  
DEMO1.C  
This program is provided as-is. Do not call for technical support for this free  
program.  
#include <dos.h>  
#include<stdio.h>  
#includeMCROCOMM.C”  
int port;  
int memtype;  
int addr;  
int count;  
char buf [16];  
int temp;  
int z,x,y,value1, value2 = 0;  
main ( )  
{
while (z == 0)  
{
port = 2 ; /* COM3 */  
memtype = 2;  
addr = 1;  
count = 16;  
temp=TCL_Rreg(port,memtype,addr,count,buf);  
x = buf[0];  
y = buf[1];  
value1 = (x & 0x00ff) + ((y & 0x00ff) <<8) ;  
x = buf[2];  
y = buf[3];  
value2 = (x & 0x00ff) + ((y & 0x00ff) <<8) ;  
printf(Register 1, 2 values are %d %d \n, value1, value2);  
}
return (0);  
}
GFK–0804B  
Appendix B Micro PLC Protocol  
B-13  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
B
Sample BASIC Program  
100  
DIMBUF% (16)  
200  
210  
220  
230  
240  
250  
PORT%  
MEMTYPE% = 0  
ADDR%  
COUNT%  
= 1  
REM Port–COM2  
REM Analog Input  
REM Start Address–49  
REM Length–16 Registers  
=49  
=16  
CALL BASRreg (PORT%, MEMTYPE%, ADDR%, COUNT%, BUF%(1), ERRSTAT%)  
IF ERRSTAT% <>0 THEN GOTO 900  
300  
310  
320  
330  
340  
350  
360  
370  
380  
390  
400  
PORT%  
MEMTYPE% = 0  
ADDR%  
COUNT%  
BUF$  
= 0  
REM Port–COM1  
REM Discrete Input  
REM Start Address–33  
REM Length–16 Bits  
=33  
=16  
=SPACE$ (16)  
CALL BASRbit (PORT%, MEMTYPE%, ADDR%, COUNT%, BUF$, ERRSTAT%)  
IF ERRSTAT% <>0 THEN GOTO 900  
FOR I% = 1 TO 16  
TEMP$=MID$ (BUF$, I%, 1)  
IF TEMP$=“1” THEN PRINT “ON” ELSE PRINT “OFF”  
NEXT I%  
900  
GFK-0804B  
B-14  
Micro PLC Programmers Guide – Aptil 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Appendix C RTU Protocol  
section level 1 1  
figure_ap level 1  
table_ap level 1  
C
This appendix describes the Remote Terminal Unit (RTU) serial communications  
protocol, which can be used to provide communications between the Micro PLC or other  
remote device and a host computer.  
Message Types  
Transmission Sequence  
Message Fields  
Character Format  
Message Termination  
Timeout Usage  
Cyclic Redundancy Check (CRC)  
RTU Message Length  
RTU Table Addresses  
Message Descriptions  
Communication Errors  
Refer to appendix E for a sample RTU master program.  
Introduction  
One of the software Setup parameters for the Micro PLC is the selection of either Micro  
PLC protocol or RTU protocol. RTU protocol must be selected to use the features  
described here.  
RTU protocol is a query–response protocol used for communication between devices,  
such as the Micro PLC and a host computer. The host computer operates as the master  
device; the Micro PLC is always a slave.  
The data transferred consists of 8–bit binary characters with a parity bit. No control  
characters are added to the data block; however, an error check (Cyclic Redundancy  
Check) included as the final field of each query and response to ensure accurate trans-  
mission of data.  
C-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message Types  
There are four message types: query, normal response, error response, and broadcast.  
Query  
The master sends a message addressed to a single slave, such as a Micro PLC.  
Normal Response  
After the slave performs the function requested by the query, it sends back a normal re-  
sponse for that function. This indicates that the request was successful.  
Error Response  
The slave receives the query, but for some reason it cannot perform the requested func-  
tion. The slave sends back an error response which indicates the reason the request  
could not be processed. (No error message will be sent for certain types of errors. For  
more information see Communication Errors, page C-18).  
Broadcast  
The master sends a message addressed to all of the slaves by using address 0. All slaves  
that receive the broadcast message perform the requested function. This transaction is  
ended by a time–out within the master.  
Transmission Sequence  
The master begins a transmission by sending a query or broadcast request message. If  
the master sent a query, the slave sends a normal or error response.  
If master sends a broadcast request, the slaves do not send responses.  
Query Transaction  
Slave Turn–around Time  
Master  
Slave  
Query Message  
Response  
Broadcast Transaction  
Master  
Slave  
Broadcast Message  
(No Response)  
The time between the end of a query and the beginning of the response is called the  
slave turn–around time (see above). This varies, depending on the query and the activ-  
ity of the Micro PLC application program. 500mS is a reasonable worst–case estimate.  
GFK-0804B  
C-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message Fields  
A typical message has the fields shown below:  
FRAME  
Station  
Address  
Function  
Code  
Error  
Check  
Information  
Station Address  
The station address is the address of the slave selected for the data transfer. It is one  
byte in length and has a value from 0 to 247 inclusive. An address of 0 selects all slave  
stations, and indicates that this is a broadcast message. An address from 1 to 247 selects  
a slave station with that station address. The station address for a Micro PLC is one of its  
software Setup parameters.  
FunctionCode  
The function code identifies the command being sent. This field is one byte in length  
and may have a value from 0 to 255:  
Function  
Code  
Description  
Function  
Code  
Description  
0
1
2
3
4
5
6
7
Illegal Function  
8
9–14  
15  
Loopback Maintenance  
Unsupported Function  
Force multiple outputs  
Reset multiple registers  
Report device type  
Read Output Table  
Read Input Table  
Read Registers  
16  
17  
Read Analog Input  
Force Single Output  
Preset Single Register  
Read Exception Status  
18–127  
Unsupported function  
128–255  
Reserved for Exception  
Responses  
Information Field  
The information field contains all of the other information required to further specify or  
respond to a requested function. Detailed specification of the contents of the information  
field for each function code is found in the Message Descriptions that start on page C-9.  
Error Check Field  
The error check field is two bytes in length. It contains a cyclic redundancy check  
(CRC–16) code. Its content depends on the station address, function code, and  
information field. For information about generating the CRC– 16 code, see Cyclic  
Redundancy Check (CRC) beginning on page C-5. Note that the information field is variable  
in length. To properly generate the CRC– 16 code, the length of frame must be determined.  
See RTU Message Length (page C-8) to calculate the length of a frame for each of the  
defined function codes.  
GFK–0804B  
Appendix C RTU Protocol  
C-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Character Format  
A message is sent as a series of characters. Each byte in a message is transmitted as a  
character. The illustration below shows the character format. A character consists of a  
start bit (0), eight data bits, an optional parity bit, and one stop bit (1). Between charac-  
ters the line is held in the 1 state.  
MSB  
8
Data Bits  
LSB  
1
10  
9
7
6
5
4
3
2
0
Parity  
(optional)  
Stop  
Start  
Message Termination  
Each station monitors the time between characters. When a period of three character  
times elapses without the reception of a character, the end of a message is assumed. The  
reception of the next character is assumed to be the beginning of a new message.  
The end of a frame occurs when the first of the following two events occurs:  
The number of characters received for the frame is equal to the calculated length of  
the frame.  
A length of 3 character times elapses without the reception of a character.  
Timeout Usage  
Timeouts are used on the serial link for error detection, error recovery, and to prevent  
missing the end of messages and message sequences.  
After sending a query message, the master should wait approximately 500 milliseconds  
before assuming that the slave did not respond to its request.  
GFK-0804B  
C-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Cyclic Redundancy Check (CRC)  
The Cyclic Redundancy Check (CRC) consists of 2 check characters generated at the  
transmitter and added at the end of the transmitted data characters. The receiver gener-  
ates its own CRC for the incoming data and compares it to the CRC sent by the transmit-  
ter to ensure proper transmission.  
The transmitter calculates the CRC. The essential steps are:  
1. Multiply the data bits that make up the message by the number of bits in the CRC.  
2. Divide the result by the generating polynomial (using modulo 2 with no carries).  
The CRC is the remainder of this division.  
3. Discard the quotient.  
4. Add the remainder (CRC) to the data bits.  
5. Transmit the message with CRC.  
The receiver divides the message plus CRC by the generating polynomial. If the  
remainder is 0, the transmission was transmitted without error.  
The Generating Polynomial  
3
2
A generating polynomial is expressed as a string of terms in powers of X such as X + X  
0
+ X (or 1). It can also be expressed as a binary number. RTU protocol uses the polyno-  
16  
15  
2
mial X + X + X + 1 which in binary is 1 1000 0000 0000 0101. The CRC this polyno-  
mial generates is known as CRC–16.  
It can be implemented in hardware or software.  
GFK–0804B  
Appendix C RTU Protocol  
C-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Hardware Implementation of CRC-16  
CRC-16 can be implemented using a multi–section shift register (which is based on the  
generating polynomial):  
40473  
2
15  
16  
X
X
X
CRC Register  
LSB  
0
+
+
+
15 14  
13 12 11 10  
9
8
7
6
5
4
3
2
1
+
= Exclusive OR  
Data  
Input  
The message data bits are fed to the Shift Register one at a time. The CRC register  
contains a preset value. As each data bit is presented to the Shift Register, the bits are  
shifted to the right. The LSB is XORed with the data bit and the result is: XORed with  
the old contents of bit 1 (the result placed in bit 0), XORed with the old contents of bit 14  
(and the result placed in bit 13), and finally, it is shifted into bit 15. This process is  
repeated until all data bits in a message have been processed.  
Software Calculation of CRC–16  
The pseudo code for software calculation of the CRC–16 is given below.  
Preset byte count for data to be sent.  
Initialize the 16–bit remainder (CRC) register to all ones.  
XOR the first 8–bit data byte with the high order byte of the  
16–bit CRC register. The result is the current CRC.  
INIT SHIFT:  
SHIFT:  
Initialize the shift counter to 0.  
Shift the current CRC register 1 bit to the right.  
Increment shift count.  
Is the bit shifted out to the right (flag) a 1 or a 0?  
If it is a 1, XOR the generating polynomial with the current CRC.  
If it is a 0, continue.  
Is shift counter equal to 8?  
If NO, return to SHIFT.  
If YES, increment byte count.  
Is byte count greater than the data length?  
If NO, XOR the next 8–bit data byte with the current CRC  
and go to INIT SHIFT.  
If YES, add current CRC to end of data message  
for transmission and exit.  
When the message is transmitted, the receiver will perform the same CRC operation on  
all the data bits and the transmitted CRC. If the information is received correctly the  
resulting remainder (receiver CRC) will be 0.  
GFK-0804B  
C-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Example CRC–16 Calculation  
As an example we will calculate the CRC–16 for RTU message, Read Exception Status  
07). The message format is:  
Address  
Function  
CRC–16  
01  
07  
The Micro PLC transmits the rightmost byte (of registers or discrete data) first. The first bit  
of the CRC– 16 transmitted is the MSB. Therefore, in this example the MSB of the CRC  
16  
polynomial is to the extreme right. The X term is dropped because it affects only the  
quotient (which is discarded) and not the remainder (the CRC characters). The generating  
polynomial is therefore 1010 0000 0000 0001. The remainder is initialized to all 1s.  
In this example we are querying device number 1 (address 01). We need to know the  
amount of data to be transmitted. This information can be found for every message type  
on page C-8, RTU Message Length. For this message the data length is 2 bytes.  
1
TRANSMITTER  
RECEIVER  
CRC–16 ALGORITHM  
CRC–16 ALGORITHM  
2
2
2
2
MSB  
LSB Flag MSB  
LSB Flag  
Initial Remainder  
1111 1111 1111 1111  
0000 0000 0000 0001  
1111 1111 1111 1110  
0111 1111 1111 1111 0  
0011 1111 1111 1111 1  
Rcvr CRC after data  
1110 0010 0100 0001  
XOR 1st data byte  
Current CRC  
Shift 1  
XOR 1st byte Trns CRC 0000 0000 0100 0001  
Current CRC  
Shift 1  
Shift 2  
Shift 3  
Shift 4  
Shift 5  
Shift 6  
Shift 7  
Shift 8  
1110 0010 0000 0000  
0111 0001 0000 0000 0  
0011 1000 1000 0000 0  
0001 1100 0100 0000 0  
0000 1110 0010 0000 0  
0000 0111 0001 0000 0  
0000 0011 1000 1000 0  
0000 0001 1100 0100 0  
0000 0000 1110 0010 0  
Shift 2  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 3  
Shift 4  
1001 1111 1111 1110  
0100 1111 1111 1111 0  
0010 0111 1111 1111 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 5  
Shift 6  
1000 0111 1111 1110  
0100 0011 1111 1111 0  
0010 0001 1111 1111 1  
XOR 2nd byte trns CRC 0000 0000 1110 0010  
Current CRC  
Shift 1–8 yields  
0000 0000 0000 0000  
0000 0000 0000 0000  
ALL ZEROES FOR RECEIVER  
FINAL CRC–16 INDICATES  
TRANSMISSION CORRECT!  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 7  
Shift 8  
1000 0001 1111 1110  
0100 0000 1111 1111 0  
0010 0000 0111 1111 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
XOR 2nd data byte  
Current CRC  
Shift 1  
1000 0000 0111 1110  
0000 0000 0000 0111  
1000 0000 0111 1001  
0100 0000 0011 1100 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 2  
1110 0000 0011 1101  
0111 0000 0001 1110 1  
1
Remember, the receiver processes  
XOR Gen. Polynomial 1010 0000 0000 0001  
incoming data the same way as the  
transmitter. The example for the receiver  
begins when all data bits but not the  
transmitted CRC have been received  
correctly. Therefore, the receiver CRC  
should be equal to the transmitted CRC at  
this point. When this occurs, the output of  
the CRC algorithm will be zero indicating  
that the transmission is correct.  
Current CRC  
Shift 3  
1101 0000 0001 1111  
0110 1000 0000 1111 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 4  
Shift 5  
1100 1000 0000 1110  
0110 0100 0000 0111 0  
0011 0010 0000 0011 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 6  
Shift 7  
1001 0010 0000 0010  
0100 1001 0000 0001 0  
0010 0100 1000 0000 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Current CRC  
Shift 8  
1000 0100 1000 0001  
0100 0010 0100 0000 1  
XOR Gen. Polynomial 1010 0000 0000 0001  
Transmitted CRC  
1110 0010 0100 0001  
E
2
4
1
The transmitted message with CRC would then be:  
Address  
Function  
CRC–16  
41  
01  
07  
E2  
2
The MSB and LSB references are to the data bytes only, not the CRC bytes. The CRC  
MSB and LSB order are the reverse of the data byte order.  
GFK–0804B  
Appendix C RTU Protocol  
C-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
C
RTU Message Length  
To generate the CRC–16 for any message, the message length must be known. The  
length for all types of messages can be determined from the table below.  
Query or Broadcast  
Message Length  
Less CRC Code  
Response Message  
Length Less CRC  
Code  
Function Code And Name  
0
1
2
3
4
5
6
7
Not Defined  
6
6
6
6
6
6
2
Not Defined  
3 + 3rd byte  
3 + 3rd byte  
3 + 3rd byte  
3 + 3rd byte  
6
6
3
1
Read Output Table  
Read Input Table  
ReadRegisters  
Read Analog Input  
Force Single Output  
Preset Single Register  
Read Exception Status  
Loopback/ Maintenance  
PresetMultipleRegisters  
Report Device Type  
1
1
1
8–14  
16  
17  
Not Defined  
7 + 7th byte  
2
Not Defined  
6
8
1
18–127  
128–255  
Not Defined  
Not Defined  
Not Defined  
3
1
The value of this byte is the number of bytes contained in the data being transmitted.  
GFK-0804B  
C-8  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message Descriptions  
The following pages explain the format and fields for each RTU message.  
Message (01): Read Output Table  
Format:  
Address Func  
Starting  
Point No.  
Number of  
Points  
Error Check  
01  
Hi  
Query  
Lo  
Hi  
Lo  
Address Func  
01  
Byte  
Count  
Data  
Error Check  
Normal Response  
Query:  
An address of 0 is not allowed as this cannot be a broadcast request.  
The function code is 01.  
The starting point number is two bytes in length. It may be any value less than the  
highest output point number available in the Micro PLC. The starting point number  
is equal to one less than the number of the first output point returned in the normal  
response to this request.  
The number of points value is two bytes in length. It specifies the number of output  
points returned in the normal response. The sum of the starting point value and the  
number of points value must be less than or equal to the highest output point  
number available in the Micro PLC. The high order byte of the starting point  
number and number of bytes fields is sent as the first byte. The low order byte is the  
second byte in each of these fields.  
Response:  
The byte count is a binary number from 1 to 256 (0 = 256). It is the number of bytes  
in the normal response following the byte count and preceding the error check.  
The data field of the normal response is packed output status data. Each byte  
contains 8 output point values. The least significant bit (LSB) of the first byte  
contains the value of the output point whose number is equal to the starting point  
number plus one. The values of the output points are ordered by number starting  
with the LSB of the first byte of the data field and ending with the most significant  
bit (MSB) of the last byte of the data field. If the number of points is not a multiple  
of 8, then the last data byte contains zeros in one to seven of its highest order bits.  
GFK–0804B  
Appendix C RTU Protocol  
C-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (02): Read Input Table  
Format:  
Address Func  
Starting  
Point No.  
Number of  
Points  
Error Check  
02  
Hi  
Query  
Lo  
Hi  
Lo  
Address Func  
02  
Byte  
Count  
Data  
Error Check  
Normal Response  
Query:  
An address of 0 is not allowed as this cannot be a broadcast request.  
The function code is 02.  
The starting point number is two bytes in length. It may be any value less than the  
highest input point number available in the Micro PLC. The starting point number  
is equal to one less than the number of the first input point returned in the normal  
response to this request.  
The number of points value is two bytes in length. It specifies the number of input  
points returned in the normal response. The sum of the starting point value and the  
number of points value must be less than or equal to the highest input point number  
available in the Micro PLC. The high order byte of the starting point number and  
number of bytes fields is sent as the first byte. The low order byte is the second byte  
in each of these fields.  
Response:  
The byte count is a binary number from 1 to 256 (0 = 256). It is the number of bytes  
in the normal response following the byte count and preceding the error check.  
The data field of the normal response is packed input status data. Each byte  
contains 8 input point values. The least significant bit (LSB) of the first byte contains  
the value of the input point whose number is equal to the starting point number  
plus one. The values of the input points are ordered by number starting with the  
LSB of the first byte of the data field and ending with the most significant bit (MSB)  
of the last byte of the data field. If the number of points is not a multiple of 8, then  
the last data byte contains zeros in one to seven of its highest order bits.  
GFK-0804B  
C-10  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (03): Read Registers  
Format:  
Address Func  
03  
Starting  
Register No.  
Number of  
Registers  
Error Check  
Hi  
Query  
Lo  
Hi  
Lo  
Data  
Address Func  
03  
Byte  
Count  
Error Check  
First  
Register  
Hi  
Lo Hi Lo  
Normal Response  
Query:  
An address of 0 is not allowed as this request cannot be a broadcast request.  
The function code is equal to 03.  
The starting register number is two bytes in length. The starting register number  
may be any value less than the highest register number available in the Micro PLC.  
It is equal to one less than the number of the first register returned in the normal  
response to this request.  
The number of registers value is two bytes in length. It must contain a value from 1  
to 125 inclusive. The sum of the starting register value and the number of registers  
value must be less than or equal to the highest register number available in the  
Micro PLC. The high order byte of the starting register number and number of  
registers fields is sent as the first byte in each of these fields. The low order byte is  
the second byte in each of these fields.  
Response:  
The byte count is a binary number from 2 to 250 inclusive. It is the number of bytes  
in the normal response following the byte count and preceding the error check.  
Note that the byte count is equal to two times the number of registers returned in  
the response. A maximum of 250 bytes (125) registers is set so that the entire  
response can fit into one 256 byte data block.  
The registers are returned in the data field in order of number with the lowest  
number register in the first two bytes and the highest number register in the last two  
bytes of the data field. The number of the first register in the data field is equal to  
the starting register number plus one. The high order byte is sent before the low  
order byte of each register.  
GFK–0804B  
Appendix C RTU Protocol  
C-11  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (04): Read Analog Inputs  
Format:  
Address Func  
04  
Starting  
Number of  
Error Check  
Analog Input No. Analog Inputs  
Hi  
Query  
Lo  
Hi  
Lo  
Data  
Address Func  
04  
Byte  
Count  
First  
Analog  
Input  
Error Check  
Hi  
Lo Hi Lo  
Normal Response  
Query:  
An address of 0 is not allowed as this request cannot be a broadcast request.  
The function code is equal to 4.  
The starting analog input number is two bytes in length. The starting analog input  
number may be any value less than the highest analog input number available in  
the Micro PLC. It is equal to one less than the number of the first analog input  
returned in the normal response to this request.  
The number of analog inputs value is two bytes in length. It must contain a value  
from 1 to 125 inclusive. The sum of the starting analog input value and the number  
of analog inputs value must be less than or equal to the highest analog input  
number available in the Micro PLC. The high order byte of the starting analog  
input number and number of analog input fields is sent as the first byte in each of  
these fields. The low order byte is the second byte in each of these fields.  
Response:  
The byte count is a binary number from 2 to 250 inclusive. It is the number of bytes  
in the normal response following the byte count and preceeding the error check.  
Note that the byte count is equal to two times the number of analog inputs returned  
in the response. A maximum of 250 bytes (125) analog inputs is set so that the entire  
response can fit into one 256 byte data block.  
The analog inputs are returned in the data field in order of number with the lowest  
number analog input in the first two bytes and the highest number analog input in  
the last two bytes of the data field. The number of the first analog input in the data  
field is equal to the starting analog input number plus one. The high order byte is  
sent before the low order byte of each analog input.  
GFK-0804B  
C-12  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (05): Force Single Output  
Format:  
Address Func  
05  
Point  
Number  
Data  
00H  
Lo  
Error Check  
Error Check  
Hi  
Query  
Lo  
Hi  
Address Func  
05  
Point  
Number  
Data  
00H  
Lo  
Hi  
Lo  
Hi  
Normal Response  
Query:  
An address of 0 indicates a broadcast request. All slave stations process a broadcast  
request and no response is sent.  
The function code is equal to 5.  
The point number field is two bytes in length. It may be any value less than the  
highest output point number available in the Micro PLC. It is equal to one less than  
the number of the output point to be forced on or off.  
The first byte of the data field is equal to either 0 or 255 (FFH). The output point  
specified in the point number field is to be forced off if the first data field byte is  
equal to 0. It is to be forced on if the first data field byte is equal to 255 (FFH). The  
second byte of the data field is always equal to zero.  
Response:  
The normal response to a force single output query is identical to the query.  
Note  
The force single output request is not an output override command.  
The output specified in this request is ensured to be forced to the value  
specified only at the beginning of one sweep of the Micro PLC user  
logic.  
GFK–0804B  
Appendix C RTU Protocol  
C-13  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (06): Preset Single Register  
Format:  
Address Func  
06  
Register  
Number  
Data  
Error Check  
Error Check  
Hi  
Query  
Lo  
Hi  
Lo  
Address Func  
06  
Register  
Number  
Data  
Hi  
Lo  
Hi  
Lo  
Normal Response  
Query:  
An address 0 indicates a broadcast request. All slave stations process a broadcast  
request and no response is sent.  
The function code is equal to 06.  
The register number field is two bytes in length. It may be any value less than the  
highest register available in the Micro PLC. It is equal to one less than the number of  
the register to be preset.  
The data field is two bytes in length and contains the value that the register  
specified by the register number field is to be preset to. The first byte in the data  
field contains the high order byte of the preset value. The second byte in the data  
field contains the low order byte.  
Response:  
The normal response to a preset single register query is identical to the query.  
GFK-0804B  
C-14  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (07): Read Exception Status  
Format:  
Address Func Error Check  
07  
Query  
Address Func  
07  
Data  
Error Check  
Normal Response  
Query:  
This query is a short form of request for the purpose of reading the first eight output  
points.  
An address of zero is not allowed as this cannot be a broadcast request.  
The function code is equal to 07.  
Response:  
The data field of the normal response is one byte in length and contains the states of  
output points 01 through 08. The output states are packed in order of number with  
output point ones state in the least significant bit and output point eights state in  
the most significant bit.  
GFK–0804B  
Appendix C RTU Protocol  
C-15  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (16): Preset Multiple Registers  
Format:  
Address Func  
16  
Starting  
Register No.  
Number of  
Registers  
Byte  
Count  
Data  
Error Check  
Query  
Address Func  
16  
Starting  
Register No.  
Number of  
Registers  
Error Check  
Normal Response  
Query:  
An address of 0 indicates a broadcast request. All slave stations process a broadcast  
request and no response is sent.  
The value of the function code is 16.  
The starting register number is two bytes in length. The starting register number  
may be any value less than the highest register number available in the Micro PLC.  
It is equal to one less than the number of the first register preset by this request.  
The number of registers value is two bytes in length. It must contain a value from 1  
to 125 inclusive. The sum of the starting register number and the number of  
registers value must be less than or equal to the highest register number available in  
the Micro PLC. The high order byte of the starting register number and number of  
registers fields is sent as the first byte in each of these fields. The low order byte is  
the second byte in each of these fields.  
The byte count field is one byte in length. It is a binary number from 2 to 250  
inclusive. It is equal to the number of bytes in the data field of the preset multiple  
registers request. Note that the byte count is equal to twice the value of the number  
of registers.  
The registers are returned in the data field in order of number with the lowest  
number register in the first two bytes and the highest number register in the last two  
bytes of the data field. The number of the first register in the data field is equal to  
the starting register number plus one. The high order byte is sent before the low  
order byte of each register.  
Response:  
The description of the fields in the response are covered in the query description.  
GFK-0804B  
C-16  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
Message (17): Report Device Type  
Format:  
Address Func  
17  
Error Check  
Query  
Slave  
Run  
Mode  
Address Func  
17  
Byte Device  
Count Type  
66  
Data  
Error Check  
5
Normal Response  
Query:  
The Report Device Type query is sent by the master to a slave in order to learn what  
type of programmable control or other computer it is.  
An address of zero is not allowed as this cannot be a broadcast request.  
The function code is equal to 17.  
Response:  
The byte count field is one byte in length and is equal to 5.  
The device type field is one byte in length and is equal to 66.  
The slave run mode field is one byte in length. The slave run light byte is equal to  
OFFH if the Micro PLC is running. It is equal to 0 if the Micro PLC is not running.  
The data field contains three bytes.  
1st Byte =  
30H if the Micro PLC is a 14-point or 16-point unit  
32H if the Micro PLC is a 28-point unit  
2nd Byte =  
30H if the Micro PLC Expander is a 14-point unit  
32H if the Micro PLC Expander is a 28-point unit  
0H if the Micro PLC Expander is not present  
33H if the Micro PLC Expander is an analog unit  
3rd Byte =  
0
GFK–0804B  
Appendix C RTU Protocol  
C-17  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
CommunicationErrors  
Communication errors are divided into three groups:  
Invalid Query Message  
Serial Link Time Outs  
Invalid Transaction  
Invalid Query Message  
When the Micro PLC receives a query addressed to itself, but cannot process the query, it  
sends one of the following error responses:  
Subcode  
Invalid Function Code  
Invalid Address Field  
Invalid Data Field  
1
2
3
4
Quer y Processing Failure  
The format for an error response to a query is as follows:  
Address Exception  
Func  
Error  
Subcode  
Error  
Check  
The address reflects the address provided on the original request. The exception func-  
tion code is equal to the sum of the function code of the query plus 128. The error sub-  
code is equal to 1, 2, 3, or 4. The value of the subcode indicates the reason the query  
could not be processed.  
Invalid Function Code Error Response (1)  
An error response with a subcode of 1 is called an invalid function code error response.  
This response is sent by the Micro PLC if it receives a query whose function code is not  
equal to 1 through 8, 15, 16, or 17.  
Invalid Address Error Response (2)  
An error response with a subcode of 2 is called an invalid address error response. This  
error response is sent in the following cases:  
1. The starting point number and number of points fields specify output points or input  
points that are not available in the Micro PLC (returned for function codes 1, 2, 15).  
2. The starting register number and number of registers fields specify registers that are  
not available in the Micro PLC (returned for function codes 3, 4, 16).  
3. The starting analog input number and analog input number fields specify analog  
inputs that are not available in the Micro PLC (returned for function code 4).  
4. The point number field specifies an output point not available in the Micro PLC  
(returned for function code 5).  
GFK-0804B  
C-18  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
C
5. The register number field specifies a register not available in theMicro PLC (returned  
for function code 6).  
6. The analog input number field specifies an analog input number not available in the  
Micro PLC (returned for function code 3).  
Invalid Data Value Error Response (3)  
An error response with a subcode of 3 is called an invalid data value error response. This  
response is sent in the following cases:  
The first byte of the data field is not equal to 0 or 255 (FFh) or the second byte of the data  
field is not equal to 0 for the Force Single Output Request (Function Code 5).  
This response is also sent when the data length specified by the memory address field is  
longer than the data received.  
Query Processing Failure Error Response (4)  
An error response with a subcode of 4 is called a query processing failure response. This  
error response is sent by the Micro PLC if it properly receives a query but communica-  
tion between it and the computer fail.  
Serial Link Timeout  
The only cause for a RTU device to time out is if an interruption to a data stream of 3  
character times occurs while a message is being received. If this occurs the message is  
considered to have terminated and no response will be sent to the master. There are  
certain timing considerations due to the characteristics of the slave that should be taken  
into account by the master.  
After sending a query message, the master should wait approximately 500 milliseconds  
before assuming that the slave did not respond to its request.  
Invalid Transactions  
If an error occurs during transmission that does not fall into the category of an invalid  
query message or a serial link time–out, it is known as an invalid transaction. Types of  
errors causing an invalid transaction include:  
Bad CRC.  
The data length specified by the memory address field is longer than the data  
received.  
Framing or overrun errors.  
Parity errors.  
If an error in this category occurs when a message is received by the Micro PLC, theMir-  
co PLC does not return an error message. The Micro PLC treats the incoming message  
as though it was not intended for it.  
GFK–0804B  
Appendix C RTU Protocol  
C-19  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Appendix D CommunicationsUsing Windows DDE  
section level 1 1  
figure_ap level 1  
table_ap level 1  
D
This appendix explains how to use the demonstration program MICROWIN.EXE that is  
included with the Micro PLC software. This demonstration program is provided to  
acquaint you with an available software product that can be used to connect  
DDE-compliant Microsoft Windows programs with data in a Micro PLC.  
To run the demonstration program, you need:  
Microsoft Windows version 3.1 or later.  
(optional) Microsoft Word (version 2.0 or 6.0) if you want to read the links that are  
supported in the demonstation software.  
(optional) Microsoft Excel (version 4.0 or 5.0) if you want to demonstrate  
reading/ writing Micro PLC data using an Excel spreadsheet (sample provided).  
The Micro PLC must be set up to use Micro PLC protocol (not RTU protocol).  
Limits of the Demonstration Software  
A. The demonstration program will time out after 15 minutes.  
B. The demonstration program has only four preconfigured topic/ items; in the product  
itself, the number of links is only limited by the user s available memory.  
C. The demonstration software does not support the modem features that are available  
in the product software.  
D. The demonstration software does not support the configuration file features that are  
available in the product software.  
D-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
D
Features of the Micro PLC DDE Driver Software  
The software product, called the Micro PLC DDE Driver, allows linking real-time data  
from the plant floor into applications for display, logging, or trending. It also allows  
setting individual parameters or downloading recipes to a programmable controller  
from a supervisory computer. Features include:  
Support for direct point-to-point port connections.  
Access to all Micro PLC data memory types.  
Support for multiple data formats.  
Independent polling rates for each data point.  
Optimizes reads.  
Easy configuration.  
Support for multiple configurations.  
Ability to change driver configuration and actions via DDE links.  
Remote access through modems with automatic dialing.  
Ability to monitor DDE conversion status.  
Comprehensive error messages.  
On-line help.  
Windows DDE compliant applications such as Microsoft Excel allow data from the Micro  
PLC to be displayed in tabular or graphical form (see below).  
46189  
In addition to spreadsheet applications, data can be brought into word processing,  
database, and other applications.  
GFK-0804B  
D-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
D
Simple Demonstration using Microsoft Word  
The Micro PLC software includes a Microsoft Word document named WORD.DOC. It  
can be used to read data links provided by the demonstration software.  
To try it, follow these steps:  
1. First, use the Micro PLC programming software to download the file DDE1.LAD  
fromthe\ MICRO\ DDEsubdirectory to the Micro PLC. Then start the Micro PLC.  
2. Return to DOS and call up Windows.  
3. From the Program Managers menu bar, select “File/ Run”.  
4. Enter the path\ filename of the MICROWIN.EXE program  
(i.e.C:\ MICRO\ DDE\ MICROWIN.EXE)and clickOK.  
5. Select“Settings/ SerialPort Settings” from the MICROWIN menu bar.  
6. Change the COM Port to reflect the serial port where the Micro PLC is connected.  
7. Select Actions/ Toggle StopRun Driver ” from the MICROWIN menu bar. This will  
start the driver communication with the PLC.  
8. After the driver is started and communicating, start Microsoft Word.  
9. Open the Word document(C:\ MICRO\ DDE\ WORD.DOC)and click“YESto  
re–establish the links with the MICROWIN driver.  
The values shown in the document will be “real time” data values being read from the  
Micro PLC.  
Demonstration using Microsoft Excel  
An Excel sheet (EXCEL.XLS) and an Excel macro (EXCEL.XLM) are provided with the  
demonstration software. They can be used to demonstrate how the software can read  
and write Micro PLC data.  
1. Start the DDE driver.  
2. Begin communication with the Micro PLC as described above.  
3. After the driver is started and communicating, start Microsoft Excel.  
4. Open the excel sheet (EXCEL.XLS) and click “YES” to re–establish the links with the  
MICROWIN driver.  
The values shown in the spreadsheet will be “real time” data values being read from the  
Micro PLC.  
To change the values shown in the spreadsheet open the Excel macro (EXCEL.XLM) and  
click the “Run Macro” button. This macro will poke new data values to register 1,  
register 2, and output 1.  
GFK-080B4  
Appendix D Communications Using Windows DDE  
D-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
D
Viewing PLC Data in Windows  
Follow these steps:  
1. First, use the Micro PLC programming software to download the file DDE1.LAD  
fromthe\ MICRO\ DDEsubdirectory to the Micro PLC.  
2. Return to DOS and call up Windows.  
3. From the Program Managers menu bar, select “File/ Run”.  
4. Enter the path\ filename of the MICROWIN.EXE program  
(i.e.C:\ MICRO\ DDE\ MICROWIN.EXE)and clickOK.  
5. Select“Settings/ SerialPort Settings” from the MICROWIN menu bar.  
6. Change the COM Port to reflect the serial port where the Micro PLC is connected.  
7. Select Actions/ Toggle StopRun Driver ” from the MICROWIN menu bar. This will  
start the driver communication with the PLC.  
8. Select “Options/ Driver Messages” from the MICROWIN menu bar.  
9. Select one of the links in the “Topic/ Item List”. The Data associated with this item  
will be displayed in the selected item editbox. The demonstration program lists these  
four links:  
CPUID/ R,1  
CPUID/ R,2  
CPUID/ I,1  
CPUID/ O,1  
#convs=0,#Blk=3,A=0,L=2  
#convs=0,#Blk=3,A=0,L=2  
#convs=0,#Blk=2,A=0,L=1  
#convs=0,#Blk=1,A=0,L=1  
Each line above displays the link information in the form:  
[TOPIC] / [ITEM] – #conv=[c],#Blk=[b],A=[a],L=[l] where,  
[TOPIC} = “CPUID” and is the same for all four links.  
[ITEM] = the item of each one is different and this is what determines what  
data value in the PLC is being addressed. The item of the first one is “R,1”  
which represents Register 1. The second one is “R,2” which represents Register  
2. The third one is “I,1” which represents the state of Input 1. The fourth is “O,1”  
which represents the state of Output 1.  
[c] = refer to the driver help file.  
[b] = refer to the driver help file.  
[a] = refer to the driver help file.  
[l] = refer to the driver help file.  
GFK-0804B  
D-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
D
Viewing PLC Data in another DDE-compliant Application  
You can view the PLC data in another DDE-compliant application by copying the data  
link to the Window s clipboard and then pasting the link into the application.  
To copy the link to the clipboard, from the “Options/ Driver Messages” screen select the  
desired link in the “Topic/ Item List” by clicking on it and then clicking the Copy button.  
To paste the link in another application, switch to the other application and paste the  
link (this is typically done with the “Paste Special” or “Paste Link” option from the “Edit”  
selection on the menu bar, but the exact procedure may vary depending on the  
application).  
Writing Values to the PLC from another Application  
To write data to a PLC address, the client DDE application must POKE the desired value  
to the server link that represents the address. Note: in this demonstration software, the  
only topic that is supported is “CPUID” and the only items supported are the following:  
“R,1”,“R,2”,“I,1”,“O,1”.  
The following Microsoft Excel macro (in cells A1 through A4) writes the value in cell B1  
to register 1.  
cell A1 – INITIATE(”MICROWIN”,”CPUID)  
cell A2 – POKE(A1,”R,1”,B1) cell A3 – TERMINATE(A1)  
cell A4 – RETURN()  
cell B1 – Data for Register 1  
This specific macro would execute the following steps:  
1. TheINITIATE” function opens a DDE channel to Server “MICROWIN” and Topic  
CPUID”.  
2. The “POKE” function writes the data value in spreadsheet cell B1 to register 1  
(”R,1”).  
3. TheTERMINATE” function closes the DDE channel that was opened in cell A1.  
4. The “RETURN” function ends the macro.  
Ordering Information  
For information about ordering this product, and for technical support, contact:  
Engineering Specialists Inc.  
12805 W. Burleigh Rd.  
Brookfield, WI 53005–3119  
414–782–3050  
GFK-080B4  
Appendix D Communications Using Windows DDE  
D-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Appendix E Data Acquisition, Logging, and Display  
section level 1 1  
figure_ap level 1  
table_ap level 1  
Program  
E
This appendix describes the RTU-based Data Acquisition, Logging, and Display Program  
software, which is provided on the Micro PLC software diskettes. Note that not all of the  
capabilities of the Display software described here are available when it is used with  
multiple Micro PLCs on a Micro PLC Net (see below).  
Features  
The Data Acquisition, Logging, and Display Program software provides the following  
capabilities for your Micro PLC system:  
Data acquisition and display from Micro PLCs.  
Easy to make screen displays (no programming) with embedded/ updating data.  
Multiple screens can be created, and called up with a single keystroke for display.  
Logging of “out of range” data to disk.  
Writing of banks of registers (recipes) to the PLC from diskette. The register bank  
data is created with a text editor, and may be documented as part of the file.  
Manual interrogation of remote devices allowing debug of the communications  
network,and/ or RTU driver devices.  
Display of pre–programmed messages (stored in the computer) based on register  
contents in a remote device.  
Note  
This free software is provided “as– is”. GE Fanuc makes no warranty of any kind with  
respect to this software.  
GE Fanuc does not expect to provide enhancements or modifications to this program.  
You are free to use this program in any way you wish, except that you should not use  
this program in a critical application, and you are not authorized to distribute copies.  
Do not call requesting support for this program.  
Using the Display Software with Micro PLC Net  
Creating a network with multiple Micro PLCs requires the Micro PLC Net product  
described in the Micro PLC Users Guide. The MICRONET software establishes a  
point-to-point communications link with only one device at a time. Therefore, a system  
using the Display software on a Micro PLC Net can only communicate with one device  
at a time. To establish communications with different devices, it is necessary to return to  
DOS and re-invoke the MICRONET software to make each new connection.  
E-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
E
Overview  
DISPLAY is an easy to use program that runs on an IBM PC, XT, or AT-compatible  
computer. It allows monitoring of Micro PLCs using the RTU protocol. You dont need to  
know how to use RTU protocol to use the Display software. However, you do need to set  
up the Micro PLC to operate using RTU protocol. Setup instructions are in chapter 7 of this  
manual. If you want to learn about RTU protocol, see appendix C.  
The main features of the Display software are:  
Auto-polling screens that display actual data from Micro PLCs and other remote  
RTU devices. The example Auto-polling screen shown below displays the contents of  
four registers in a Micro PLC.  
Multiple screens can be created ahead of time ( using a built-in text editor), then  
displayed with a single keystroke while the system is running. The data on the  
screen will be continuously updated. No programming is required, except for typing  
in the display screens as you wish them to appear.  
Normal operating limits can be set for any data items. “Out of range” data can be  
visually flagged on the screen and optionally logged to disk for later evaluation. In the  
example above, the boiler temperature has exceeded the limit in the HIGH direction.  
The value and corresponding HIGH (or LOW) indication blink.  
Display of system messages in an independent area on the bottom of all Auto-polling  
screens. In the above example, the message “Please close the upper door” appears.  
Messages with negative numbers blink. System messages are created ahead of time  
and saved in a file like this:  
Display of system messages is controlled by a Micro PLC on the network.  
GFK-0804B  
E-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
E
Ability to download register data such as recipes to a Micro PLC. Comments can be  
used in the file, as in the following example, to describe the data being downloaded. In  
this example, data is sent to registers R100, R101, R102, and R103. To the application  
program in the Micro PLC, these registers represent paint color, number of widgets,  
starting serial number, and oven temperature.  
Finally, a Manual mode is available which allows you to poll a Micro PLC, and  
observe both the transmitted data (including header and checksum information)  
and the received data. This is valuable when you are trying to determine that the  
Micro PLC is actually sending the appropriate register or I/ O data.  
In Manual mode, you can also send data to the Micro PLCs register or I/ O tables as  
individual words, and to the register table as a bank of up to 30 (typical) registers.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
EquipmentRequired  
Computer:  
IBM PC/ XTor AT or equivalent.  
Micro PLC CPU:  
MDR014C, MDR114C, MDR028B, MDR128B,  
MAA014B,MDD016A.  
Micro PLC Cable  
Programming Software (optional):  
Version 2.42  
Micro PLC NET (optional):  
Master interface module:  
Slave interface module:  
Software:  
HE485MST232  
HE485SLV232  
part number not available at time of publication;  
contact Horner Electric for information.  
GFK-0804B  
E-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Startup  
The DOS files COMMAND.COM and MODE.COM (or MODE.EXE) need to be in the  
search path. If you are unsure how to set up your path, you may copy these files to the  
same directory where Display is located.  
To try a quick experiment, connect your PC to Micro PLC cable to COM1 of your  
computer, and to a compatible Micro PLC (MDR014C, MDR114C, MDR028B, MDR128B,  
MAA014B, MDD016A). Use version 2.42 of the programming software to set the Micro  
PLC communications mode to “RTU”. Then exit the programming software package.  
Then go to the subdirectory\ Micro\ RTUDEMO, and type TRY–IT .  
Use ESC to return to DOS.  
Invoking DISPLAY  
After booting with your diskette or going to the DISPLAY subdirectory, you can invoke  
the Display software in two different ways:  
A. If you want to start the Display software and immediately begin executing an  
existing Auto-polling screen, type: DISPLAY filename.SCN baudrate.  
Use the filename of the Auto-polling screen you want to execute and enter the baud  
rate. The baud rate can be 300, 1200, 2400, 4800, or 9600. 9600 baud requires a very  
fast computer. For a slower computer, such as a 286, 2400 baud is probably the  
maximum. (The Micro PLC setup must also specify the same baud rate).  
This startup method is useful to automatically restart Display after a power cycle.  
Your AUTOEXEC.BAT file could include the line DISPLAYFILENAME.SCN  
BAUDRATE (e.g. Display Demo.scn 4800).  
B. If you want to go to the Display software main menu, type: DISPLAY baudrate  
For example,DISPLAY 4800.  
A startup screen appears. From there, press any key to go to the Main menu:  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
The Display Software Menus  
Main Menu  
Auto Polling Operation  
A = Auto Operation  
M = Manual Operation  
S = Set up Colors  
R = Set up Message Register  
H = Help  
C = Create/Change Screen file  
E = Execute Screen file  
M = Edit Messages file  
H = Help  
Esc = exit  
Esc = Back to main menu  
Manual Operation  
Q, I, R = Read Q,I,R Table Word  
H/L = Hi/Lo Set Output Table Bit  
W = Write Single Register  
M = Multiple word/byte Read  
C = Create/Change Register file  
B = Write Register Bank file  
E = Exception Report  
R = Report Device Type  
P = Help  
Esc = Back to main menu  
Set up Screen/Border Colors  
Up arrow or F = + Text  
Down arrow or D = –Text  
Right arrow or B = + Border  
Left arrow or V = – Border  
Set up Message Register  
Enter ID of device :  
Enter pointer register number :  
To Create or Execute Auto-polling Screens: Select A from the Main menu. For  
creating Auto-polling screens, see the instructions on page E-13. For executing  
Auto-polling screens, see the instructions on page E-21.  
To Manually Poll a Micro PLC: Select M from the Main menu. See page E-9 for  
instructions.  
To Change Data in a Micro PLC: Select M from the Main menu. See page E-9 for  
instructions.  
To Download Registers to a Micro PLC: Select M from the Main menu. See page E-11.  
To Change the Software Screen Colors: Select S from the Main menu. See page E-7  
for instructions.  
To Create or Edit System Messages: Select A from the Main menu. See page E-19 for  
instructions.  
To Set Up a Micro PLC (or Other Device) to Control System Messages: Select R  
from the Main menu. See page E-20 for instructions.  
To Exit to DOS: You can exit to DOS from this menu by pressing the ESC key. You can  
also exit to DOS at any time by pressing Control–Break.  
GFK-0804B  
E-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Changingthe Screen Colors  
If you want to change the screen colors for using the Display software, select S from the  
Main menu. (Colors for the Auto-polling screens are set up separately; see page E-18).  
When you select S, this setup window appears:  
Use the keys indicated to change the foreground (text and background) and border  
colors. The current colors are indicated by numbers in the bottom line of text.  
The 7,7 defaults work best for monochrome displays. If you change the defaults, you  
may not be able to see the cursor when you are looking at a directory screen in either the  
auto or manual mode.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-7  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Editing Summary  
Basic editing functions for the screen, message, and register files are listed below.  
Aborting a Function: Use the ESC key to stop most functions. Pressing ESC with no function  
started exits the editor. ALT F7 will undo most of the block level commands, if necessary.  
Cursor Movement: Use the page up and page down keys to move the text up or down one page at  
a time. Control page up, and control page down move to the beginning or end of the file.  
Home positions the cursor in column 1, and end puts the cursor at the end of the line.  
String Search: To search for a string (case sensitive), press control F3, then enter the string. Press  
F3 again. The cursor will move to the first occurrence of that string. To find the next  
occurrence, push F3 again.  
Block Copy: To copy a block of text, position the cursor at the beginning of the block and press  
Control F5. Then move the cursor to the end of the block, and press Control F5 again.  
Finally, move the cursor to the desired position for the copy to be placed, and press  
Control F5 again. To make another copy elsewhere, move the cursor and press Shift F5.  
Block Move: Use the ALT F6 keys to move a block of text (similar to the block copy, above).  
Copy From Disk File: To copy a file from disk into your working file, position the cursor at the  
desired copy location, and use the F7 key. Enter the filename that contains the text to be  
copied. Position the cursor at the beginning of the text to be copied and press F10. Then  
move the cursor to the end of the text to be copied and press F10 again.  
Save Part Of The File To Disk: To save part of a file to disk, place the cursor at the start of the text  
to be saved, then press ALT F5. Move the cursor to the end of the text and press ALT F5  
again. Enter the filename for the save. This file can be later read using the F7 key.  
Misc: TheIns/ 0key toggles the insert/ overwrite mode. To delete a line, use control Y.  
Another set of editing commands can also be used. See the Help screen for details  
GFK-0804B  
E-8  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Manual Mode  
This section explains how to use Manual mode to manually poll the selected Micro PLC:  
Reading one word of input, output, or register data  
Setting an output low or high  
Writing a single register  
Creating or changing a register file  
Writing data to a register file  
Creating a report of exceptions  
Reporting the device type  
Manual mode is useful to determine the mapping of the Micro PLC, the integrity of the  
interconnects, and other factors before creating an auto polling screen.  
Data Format  
In Manual mode, both transmitted data and received data are displayed in hex format.  
In addition, both transmitted and received data displayed show header and checksum  
information. Received data also explicitly shows the “data” from the response. All  
returned data is 16 bits.  
If the response has a bad checksum, wrong target ID, or wrong function number, this is  
displayed before the data is shown. If no response is forthcoming (for example, if there is  
an improperly wired cable), then “Bad Checksum” is shown along with no actual  
received data.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-9  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Entering Manual Mode  
To go to Manual mode, press the M key at the main menu. The menu of Manual mode  
selections appears to the right of the Main menu.  
You can press ESC to return to the main menu, or press P for help.  
Reading One Word of Input, Output, or Register Data  
The R,Q, and I options each read a word of data from the register, output, or input table.  
In the example below, Q was selected. Then target ID = 1 and address 1 were  
designated as the data to fetch.  
The data returned was FF FF (hex) which indicates that outputs Q1– Q16 were all high (1).  
Reading Multiple Bytes of Input, Output, or Register Data  
The M option allows reading of multiple bytes from any of the tables. The data which is  
being transmitted is shown as hex bytes from left to right in the order they are  
transmitted. Generally the first byte is the target ID, and the second byte is the function  
number. The last 2 bytes are the checksum. The bytes in between are the start addresses,  
lengths, and data if applicable. The received data is shown in the same format. The data  
bytes are bracketed by ––> DATA BYTES <–– left and right arrows.  
GFK-0804B  
E-10  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Creating a Bank of Registers for Downloading Data  
In Manual mode, you can create files of register data to be downloard to a Micro PLC.  
With this option, it is possible to store recipes on diskette which can then be downloaded  
to the PLC when appropriate.  
A sample of this register bank file is shown below:  
Select C. The screen displays:  
Enter a name for the file that will contain the information to be downloaded to the  
target registers. The filename must end with the suffix .REG. Press the Enter key.  
A blank screen appears to enter the information.  
Start the first line by entering the starting register and the target ID of the Micro PLC (or  
other device) that will receive the information. Separate the items using commas. The  
required format is:  
R,#,T,#  
For example:  
R,15,T,1 ; Begin at register 15, Micro PLC Target ID 1  
Register (15) Target ID (1)  
Comment (starts with ;)  
You can also include a comment that starts with a semicolon character, as shown above.  
Go to the next line of the file and start entering the values (decimal numbers) to be  
downloaded to consecutive registers in the Micro PLC. The data values may be in the  
range –32768 to +32767.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-11  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Data values can be entered on separate lines, or on the same line but separated by  
spaces. For example, here are two ways to format the same data:  
R,15,T,1 ; This specifier must be on line 1, and be as shown.  
156  
–945  
; This is register 15, the setpoint temperature for the donut ovens.  
; R16 contains the number of donuts we are ahead of schedule with  
4467 ; This will be R17 data.  
OR  
R,15,T,1  
156 –945 4467 ; R15–R17 contains the donut specific information  
In the first example, each value is on a separate line, and each line includes a comment.  
In the second example, the second line of the file contains all there values to be  
downloaded, separated by spaces.  
When entering numerical data do not use commas. For example, for the number  
ten–thousand, you must enter 10000, not 10,000.  
Anything on a line followed by the “;” character is interpreted as a comment. This  
allows you to document the contents of your recipe files. The first item on the line must  
be the register contents.  
After completing the file, press F10 to save the file and return to the menu.  
Writing Data to the Registers  
To download a completed register file to the selected Micro PLC, select B from the  
Manual Operation menu. The screen will show a list of files ending in the suffix: .REG.  
Select a file to download by highlighting the filename and pressing the Enter key. The  
file will appear for you to review. If you want to download the file, press the F10 key. A  
prompt like the example shown below appears.  
The Start register, and length appear as a double check that the data was entered into  
the register bank file. Press any key to download the file.  
GFK-0804B  
E-12  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Creating or Editing Autopolling Screens  
This section explains how to create or edit display screens that can be used for:  
Displaying selected input, output, and register data from multiple Micro PLCs or  
other remote RTU devices.  
Writing a Value to a Register  
Forcing an Output  
Obtaining Register Data from a Disk File  
To create a screen, or change an existing one, from the main menu type A (Auto Polling).  
You will see the menu shown below.  
To create or edit a screen file, press C.  
Naming an Auto-polling Screen File  
At the prompt, enter the file name you wish the screen to have. During operation, it will  
be possible to display (execute) any screen through the menus provided. However, it will  
also be possible to change from one screen to another with a single keystroke if you give  
the screens the following names: 0.SCN, 1.SCN, etc. up to 9.SCN. These screens can be  
loaded and executed with a single keystroke (“0” thru “9” keys).  
You can create the screens with these names, or rename them later using the DOS  
rename command (COPY may also be used – for example, COPY DEMO.SCN 1.SCN  
will replace the). present 1.SCN with the DEMO.SCN screen).Press the Enter key.  
You should always name your screens with a .SCN extension. This is required to execute  
screens from within the DISPLAY environment or from the DOS command line.  
After entering the filename, press the Enter key to continue.  
Specifying an Existing File to Edit  
If you want to change an existing Auto-polling file, follow the steps above. When  
prompted for a filename, enter the name of the file you want to change. Then press the  
Enter key.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-13  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Creating an Auto-polling Screen  
For a new screen, the following display appears:  
During operation, an Auto-pollng screen can display up to 21 lines of text and data  
items. A very simple screen is shown below.  
To create a screen, enter the following on the first 21 lines of the file:  
Text.  
A Data Display string for each data item that will appear on the Auto-polling screen.  
These optional items are usually placed below the 21st line, so they will not be displayed:  
A Data Limits string for each item that will be assigned high/ low limits.  
An optional Color Setup Data and Logging Interval string.  
The following pages explain how to enter formatting strings. Instructions for using the  
text editor are on page E-8.  
Note: Dont use tabs while in the editor or your remote data will end up at the wrong  
place on the screen. Use spaces instead of the TAB key.  
GFK-0804B  
E-14  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Formatting Strings for Auto-polling Screens  
There are 3 types of formatting strings that set up the display and operating parameters  
for the auto-polling display screens. The 3 setup strings are:  
1. Data display formatting string (e.g. &R32H1). See page E-16.  
2. Optional data limits formatting string (e.g. &L,R,32,–100,100). See page E-17.  
3. Optional color setup/ logging formatting string (e.g. &#,10,10,0). See page E-18.  
In general, all the required information must be included in the string as shown,  
including commas. None of the items in the string are optional, they must be included.  
If any item is missing in a string, the entire string is treated as normal text, and has no  
effect on operation. In the third item above, for example, if your string was &#,10,10  
(missing the data logging time interval) then the entire string would be ignored, and the  
defaults of 7,7,0 would be used.  
Note that while commas are required in the limits string and the colors/ logging string,  
commas must not be used in the data display string.  
Text for Auto-polling Screens  
In the file for an Auto-polling screen, anything that is not specifically formatted as one of  
the strings listed above is treated as regular text. For example, the following line has both  
a formatting string and texxt:  
&L,R,5,350,450  
This sets the normal limits of R5 to 350 to 450.  
Setup String  
Display Text  
Setup for Data Logging During Auto-Polling  
It is sometimes desirable to save the displayed Auto-polling data to disk, especially if the  
data is out of range, indicating some type of error condition.  
Saving data to disk requires the following setup:  
1. A non–zero logging time must be entered in a Color/ Setup Formatting string (see  
page E-18).  
2. A data limit must be set for at least one of the values on the screen (see page E-17.).  
When one or more of these limits are exceeded, in either the positive or negative  
direction, logging will begin.  
Data logging can use a lot of disk space, so be sure you have enough space available if  
you plan to log data.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-15  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Data Display String Format – &XYYYYYZN  
Use this setup string format to:  
Specify one input, output, and/ or register to include on the Auto-polling screen.  
Specify the target ID of the Micro PLC that is the source of the data.  
Specify how the data for that item should be displayed.  
Enter a Data Display String for each data item to be displayed on the screen.  
This string can be located anywhere in the first 21 lines of the screen. It is normally mixed  
with text to explain what the data is. Do not use commas in this string  
The & character must start on the screen to the left of column 70, or there will not be  
room to display the resulting data.  
Lower case R,I,Q,H,D,B are not allowed, caps must be used.  
If you specify Input (I) or Output (Q) data, and hex (H) or decimal (D) format, the actual  
Auto-polling screen will display 16 consecutive bits starting with the indicated reference.  
Format:  
&XYYYYYZN  
N =  
Z =  
target ID  
H for hexadecimal display  
D for signed decimal display (–32766 to +32767)  
B for binary (single bit) display ( 1 or 0)  
reference address of R, I, or Q (1 to 5 digits – decimal)  
R, I, or Q (registers, inputs, or outputs)  
Y =  
X =  
Example:  
&I97B1  
Micro PLC = target ID #1  
B for binary (single bit) display  
97 = reference address  
I = Inputs  
GFK-0804B  
E-16  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Data Limits Format – &L,X,YYYYY,Low_Limit,Hi_limit  
Use this setup string format to specify a high and low limit for a register, input, or output.  
If the specified item exceeds either limit, the word HIGH or LOW appears on the  
Auto-polling display. In addition, the item blinks.  
Limits are also used to control data logging to disk. Data logging occurs only if a data item is  
beyond one of its limits, AND if the data logging interval (see the next page) is set to some  
non-zero value. If you want to log everything on a screen regardless of status, then set the  
limit(s) on some data item so that it will always be out of range. For example, if you wanted  
to trigger on output bit Q27, you could set the limits of Q27 as &L,Q,27,0,0. Logging would  
occur whenever Q27 was set to 1. When Q27 was equal to 0, logging would stop. You  
could then manually control the logging with a hardwired switch in the PLC, or with the  
^H and ^L commands available in the auto–screen and manual modes.  
This formatting string is normally located below the first 21 lines of the screen, to  
de–clutter the screen and allow for more space for other items. It can be located in the  
first 21 lines if desired, however.  
Enter a Data Limits String for each data item to be assigned limits.  
Format:  
&L,X,YYYYY,Low_Limit,Hi_Limit  
High limit  
Low limit  
Y =  
X =  
L =  
reference address of R, I, or Q  
R, I, or Q (registers, inputs, or outputs)  
limit information follows  
Example:  
&L,R,32,–10000,+13000  
High limit  
Low limit  
32 = reference address  
Registers  
L =  
limit information follows  
Use comma to separate the individual items. Do NOT use commas within a limit,  
however (e.g. dont enter “–10,000”).  
&L  
indicates the data to follow is limit information  
R,Q, or I (capitals only)  
X
YYYYY  
Low_limit  
Reference to which the limit will be applied – 1 to 5 decimal digits.  
Any number within the available display range. Enter this number in  
signed decimal, regardless of the format in which the actual data will be  
displayed (see the previous page).  
Hi_limit  
Any number within the available display range. Enter this number in  
signed decimal, regardless of the format in which the actual data will be  
displayed.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-17  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Colors/logtime setup format – &#,SC,BC,LT  
Use this setup format to:  
Change screen colors for the Auto-polling screen you are working on (other  
Auto-polling screens can use different colors).  
The screen and border colors default to 7,7 which is recommended for monochrome  
monitors. However, you can specify any colors your computer can generate. If you  
want to try out a color combination before using it here, go back to the Main menu and  
select Setup Colors (S).  
Specify a time interval for logging screen data to disk.  
This formatting string is normally located below the first 21 lines of the screen, to  
de–clutter the screen and allow for more space for other items. It can be located in the  
first 21 lines if desired, however.  
Format:  
&#,SC,BC,LT  
time between logs to disk  
border color  
text and background colors  
setup information follows  
Example:  
&#,7,7,10  
10 seconds between logs to disk  
border color  
text and background colors  
setup information follows  
&#  
SC  
BC  
LT  
indicates that setup information follows  
Text/ background color combinations. 7 is recommended for monochrome.  
Border color. 7 is recommended for monochrome.  
Time between data logs to disk. 0 turns the data logging off.  
To turn logging off, make the log time parameter in the setup string equal to 0.  
To turn logging on, enter a logging time interval of up to 32000 seconds  
(8.89 hours). If any data on the screen is out of range, the data will be saved to  
disk at this time interval (10 seconds in this example). This time does not affect  
the normal screen update time.  
The logging time cannot be faster than the screen update time. If you are  
running at 300 baud, it may take 10–20 seconds to update a screen. It is not  
possible to log the disk data any faster than this, no matter what value is put in  
the formatting string.  
GFK-0804B  
E-18  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
System Messages  
This section explains how to:  
Create or edit system messages that can be displayed on the bottom of the  
Auto-polling screens.  
Specify a Micro PLC to control system messages  
Trigger system message displays during Auto-polling operation  
System messages are activated by one (and one only) Micro PLC. However, the device  
that controls the system messages must be the one currently selected using the  
MICRONET software. With that device selected, the messages appear no matter what  
Auto-polling screen is executing.  
System Message Window on the Auto-polling Screen  
Important messages can easily be set up to blink on the display.  
Creating or Editing System Messages  
To create or edit system messages, enter A” from the Main menu to display the  
Auto-Polling screen:  
1. Enter “M” from the Auto-polling screen. The system messages file appears. At first,  
this file has no contents.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-19  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
An example completed message file could be:  
2. Enter the system messages you want to appear during system operation. Each  
message must fit on one line.  
Start each message with a number in the range of –32768 to 32767.  
If you want a message to blink on the display, give it a negative number.  
Do not place a comma in the message number. The software interprets any  
numbers after a comma as part of the actual message.  
Do not leave empty lines; messages beyond that point will not be used.  
Specifying the Device to Control System Message Display  
During system operation, display of the system messages is controlled by the contents of  
a single register at a Micro PLC.  
1. Go to the main menu and press the R key for “Setup Message Register ”.  
2. Enter the ID of the Micro PLC that will control the execution of the system messages.  
Press the Enter key.  
3. Enter the number of the register (in that PLC) that will contain the message pointer.  
Triggering Display of a System Message During Auto-polling Operation  
To trigger a message, the Micro PLC specified as the Message Register Source must place  
the number of that message in its Message Register.  
For example, if you specified Target ID = 1 and Message Register 2, the Micro PLC with  
target ID = 1 would be the message controller, and the contents of register 2 would  
contain the number of the message.  
If the register contains a number for which no message has been programmed, NO  
MESSAGE is displayed in the message window. NO MESSAGE may also be displayed if  
a transmission error from the message pointer register caused the data to be suspect.  
GFK-0804B  
E-20  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Auto-Polling During System Operation  
This section explains how to:  
Execute an Auto-polling screen  
Print the current screen  
Write a data value to a register  
Force an output  
Obtain register data from a disk file  
Executingan Auto-polling Screen  
To execute an Auto-polling screen, select E from the Auto-polling Operation menu You will  
see a directory listing of the available Auto-polling (.SCN) files which can be executed.  
Move the cursor to the one you want and press the Enter key. If communications are  
properly established, the screen appears and the data begins to fill in. If communications  
have not been established, as in the example below, it will be indicated on the screen.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-21  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Changingthe Display  
If you want to return to the Auto mode menu, press the ESC key.  
If you want to display another screen (and screens are named 0.SCN to 0.SCN), press the  
appropriate number key 0 through 9. The new screen will take a few seconds to start up.  
Printing the Screen  
If you want to print a copy of the screen, use the Shift–PrtSc keys. Note that the  
background data screen stops updating while the screen is printing.  
Note  
Be sure that you have a printer connected, or the system will hang up.  
When you press Shift–PrtSc, the display freezes. That means the data on the screen will  
be partly old data and partly new data.  
Writing a Value to a Register  
If you want to write a register value (for example, for testing), press Control–W. Note  
that the background data screen stops updating during this function.  
Note: if the CPU writes to the same register during its logic scan, the CPUs value will  
overwrite the value you entered manually.  
Forcingan Output  
If you want to force an output point high, press Control–H.  
If you want to force an output point low, press Control–L. Note that the background data  
screen stops updating during this function.  
Note: if the CPU writes to the same output during its logic scan, the CPUs point state  
will overwrite the state you entered manually.  
ObtainingRegister Data from a Disk File  
This option could be used to preset a bank of registers for test purposes, or to download  
a new “recipe” to the PLC. Note that the background data screen stops updating during  
this function.  
If you want to obtain a bank of registers from disk file, press Control–B.  
Note: if the CPU writes to the same registers during its logic scan, the CPUs data will  
overwrite the data you obtained from the disk file.  
GFK-0804B  
E-22  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Data Logging  
This section describes:  
How Data Logging Works  
The .LOG File  
The Format of Logged Data  
How Data Logging Works  
During Auto-pollingn, data logging occurs at a selected time interval if some data on the  
screen is out of range. If all values are in range, no logging is done at the specified  
interval.  
If any of the displayed values are out of range (indicated by a blinking data value  
followed by HIGH or LOW), and a non–zero logging time has been specified, all the  
screen data is saved to disk.  
Data logging starts at the end of the screen update, immediately after a data item goes  
out of range. Subsequent data logs occur at the end of the first screen update that  
exceeds the specified logging time. For example, if you have specified an update time of  
20 seconds, and your first log occurs at time=0, and the screen update time is 8 seconds,  
then the next log will occur at 24 seconds since this is the first ”end of screen update”  
beyond the 20 seconds specified.  
If data logging is already occurring when a new item goes out of range, the screen data  
is logged at the next opportunity and the logging timer is set to 0. Subsequent data logs  
then occur at the scheduled intervals.  
If the same item goes out of range, then in range, then out of range during the logging  
time period, the data logging records each in to out of range transition, and restarts the  
log timer for each “in to out of range” transition.  
The .LOG File  
Logged data is stored in a file with the same name as the current Auto-polling screen,  
anf the extension .LOG. For example, the file 2.LOG would contain the logged data for  
Auto-polling screen 2.SCN.  
Renaming the .LOG File to Prevent Overwriting Data  
When a screen starts executing, the utility automatically clears the .LOG file for that screen,  
even if no data is being saved yet. If there are contents in the file, they are cleared also.  
Therefore, if you want to save the .LOG file for future reference, be sure not to execute a  
screen with the same name before you have renamed the .LOG file using DOS.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-23  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
The Format of Logged Data  
Each data item on the Auto-polling screen at the time the log to disk starts is saved as a  
line in the .LOG file. Each line in the .LOG file has the following format:  
log_data(1990,2,10,11,32,57,”&R”,1234,97,1)  
year month day hour minutes secs table reference data value target id  
These items are explained below.  
Time Stamp (Year, Month, Day, Hour, Minutes, Seconds)  
The time stamp represents the time logging occurred (not the time the actual data  
collection occurred). Therefore, the time stamp for each item on a screen is the same. If  
there are a lot of items on the screen and communications are running a low baud rate, it  
may take 10–20 seconds to update the screen, so the actual data collection times may  
vary by that amount.  
Also, due to the time required to update the screen, the intervals between data logs to  
disk may not correspond exactly to the time interval specified in the setup string.  
The time values used in the time stamp originate in the computer which is running the  
logging software, and not in the remote Micro PLC.  
Data Type (Table, Reference, Data Value)  
Although the logged data may represent inputs (&I), outputs (&O), or registers (&R), the  
data format is always decimal. In the example above, the value of Register 1234 was 97  
decimal at the time logging occurred.  
Target ID  
The last part of a logged data value is the ID number of the Micro PLC that provided the  
data. This ID number is assigned (using the programming software) when configuring  
the Micro PLC.  
Note that this ID may be different from the ID assigned with the DIP switches on the  
interface bos that connects the Micro PLC to the network. This is discussed in more  
detail in the appendix “Related Products” in the Micro PLC Programmers Manual.  
GFK-0804B  
E-24  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
E
Error Messages During Operation  
While you are executing a screen, the following errors may occur:  
ERROR WRITING TO DEVICE COM1  
You can test for the presence of COM 1 by typing >DIR >COM1. If you  
get a message “ERROR WRITING TO DEVICE COM1.... ”, you probably  
need something else jumpered in your COM1 serial port, or you dont  
have a COM1 port defined, or physically available.  
TIME OUT  
This message means that a response was not received from the Micro  
PLC. The problem could be lack of proper COM1 configuration, bad  
cabling, or an improperly set target ID in the Micro PLC.  
CHECKSUM This message indicates that the received data had a checksum error. The  
integrity of the data is suspect. Usually, a checksum error is caused by a  
noise burst. It can also be caused by running at the wrong baud rate, or  
a baud rate higher than your computer can properly support when  
running DISPLAY (4800 baud for an AT, 2400 baud for an XT).  
If this message appears only occasionally, you may need to lower the  
baud rate to the next lower value.  
A checksum can also occur if too much data is requested from the Micro  
PLC in when using the software in manual mode. The ability of  
DISPLAY to handle large blocks of data depends on the baud rate,  
computer speed, and other factors.  
WRONG ID  
This message means that the wrong remote device answered your  
polling request. This is not likely to occur, but the check is in there  
anyway.  
WRONG HEADER / BAD REQUEST  
Since the DISPLAY software uses only RTU functions 1–3 in auto mode,  
this is unlikely in automatic mode. In manual mode, you may get this  
error while experimenting. It will also occur if you ask for data beyond  
the end of a table, e.g. register 17K in a 16K system.  
NO MESSAGE  
This message appears in the message window if the message pointer  
register contains a value for which no message has been programmed. it  
also occurs if an error is detected in the data from the message pointer  
register.  
GFK-0804B  
Appendix E Data Acquisition, Logging, and Display Program  
E-25  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Appendix F ProgrammingApplications  
section level 1 1  
figure_ap level 1  
table_ap level 1  
F
This appendix describes some simple programming applications:  
Application #1: FLIP / FLOP (Toggle Operation)  
Application #2: Power Up One Shot (Start–up Protection)  
Application #3: Cascading Counters  
Application #4: Industrial “Starting Circuit”  
F-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
F
Application #1: FLIP / FLOP (Toggle Operation)  
This logic reverses the state of an output each time a control signal is energized. Flip  
Flops can be used to toggle an output based on the presence of an input. A typical lad-  
der logic is shown below.  
Rung 1  
| I1  
C2  
+––|+|––––––+–––––––+–––––––+–––––––+–––––––+–––––––+––()––  
| PB1  
Rung 2  
| C2  
O1  
O1  
+––||––+––|/|––+–––––––+–––––––+–––––––––––+–––––––+––()––  
|
|
|
|
|
|
|
|
| C2  
O1 |  
+––|/|––+––| |––+  
|
In the logic shown above, push button 1 (PB1) is a control signal connected into input 1  
of the Micro PLC. PB1 is a positive transition (one shot) contact. This means that each  
time PB1 is pushed, the PLC will ”see” a positive signal for only one program cycle  
(about 6 micro sec) regardless of the duration of contact.  
If PB1 is pushed at initial conditions (all inputs and outputs in their base state), output coil  
C2 comes on in rung 1. In the top branch of rung 2, contact C2 then closes, which in con-  
nection with the normally closed (N.C.) contact O1 activates output coil 1 (O1). During the  
next program cycle, C2 turns off regardless of whether PB1 is still pressed. With that, con-  
tact C2 in the top branch of rung 2 returns to its base normally open (N.O.) state. In addi-  
tion, the normally closed contact O1 in the top branch is now open (reversed state) because  
of the activation of output coil O1. Therefore, the top branch of rung 2 no longer supports  
the activation of output coil 1. In the bottom branch, however, the N.O. contact O1 is closed  
because of the activation of output coil O1, while contact C2 returns to its base N.C. state.  
Therefore, the bottom branch now supports output coil 1.  
If PB1 is pushed when output coil 1 is on, N.C. contact C2 in the bottom branch opens  
and no longer supports the output coil. In the top rung, N.O. C2 closed, but N.C. O1 is  
open because output coil 1 is on. Therefore, neither branch supports output coil 1 and  
the coil goes off. The ladder has now returned to its initial state.  
GFK-0804B  
F-2  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
F
Application #2: Power Up One Shot (Start–up Protection)  
This logic uses a special purpose coil called the Start–Up Scan Coil to provide protection  
in the event of power loss or stoppage in a program. The FLIP/ FLOP program shown in  
Application 1 has been modified for this application. A typical ladder logic is shown be-  
low.  
Rung 1  
| C1019  
C1  
+––||––+–––––––+–––––––+–––+–––––––+–––––––+–(SET)–  
|
Rung 2  
| I2  
C1  
+––||––+–––––––+––––––––––+–––––––+–––––––+–(RST)–  
| PB2  
Rung 3  
| I1  
C1  
C2  
+––|+|––+––|/|––+––––––+–––––––––+––––––––––+––()––  
| PB1  
Rung 4  
| C2  
O1  
C1  
O1  
+––||––+––|/|––+–––––––+–––––––+––|/|––––––+––()––  
|
|
|
|
|
|
|
|
| C2  
O1 |  
+––|/|––+––| |––+  
|
In the logic above, the start–up scan coil C1019 is used to set coil C1 in rung 1. Coil  
C1019 produces a positive output for a single program cycle when power is first applied  
or when the PLC is first put into RUN mode from a STOP/ PROGRAM condition. At all  
other times, C1019 is off. Because C1 in rung 1 is defined as being in a set condition, C1  
turns on when C1019 turns on and will remain on until a reset condition is activated.  
Push button 2 (PB2) in rung 2 activates the reset condition in this ladder.  
In rungs 3 and 4, N.C. contact C1 is placed immediately before the output coils. These  
contacts are open when C1 is set, which prevents either rung from being executed until  
PB2 is pushed. Once C1 is reset, both N.C. contacts return to their base states and the  
program performs normally.  
GFK-0804B  
Appendix F Programming Applications  
F-3  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
F
Application #3: Cascading Counters  
This logic provides a technique for cascading counters. Cascading allows for counting  
more events than a single counter is able to count. A typical ladder logic is shown below.  
Rung 1  
| I1  
UPCTR  
C1  
+––|+|––+–––––––+–––––––+–––––––+––+[R001]+––()––  
|EVENT  
|
|
| C1  
+––||––+–––––––+–––––––+–––––––+–––[00010]  
|
|
|
|
|
|
|
|
| I2 |  
+––| |––+  
| PB2  
Rung 2  
| C1  
UPCTR  
C2  
+––| |––+–––––––+–––––––––+–––––––+[R002 ]+––( )––  
|
|
|
|
| C2  
+––||––+–––––––+––––––––+––––––––+[0010]  
|
|
|
|
|
|
|
|
| I2 |  
+––| |––+  
| PB2  
In the logic above, I1 represents the event to be measured through input 1 on the Micro  
PLC. I1 is programmed as a positive transition contact so the counter only counts each  
activation of I1. The second input to the counter resets the counter. When an event oc-  
curs, it is counted in register R001. When the count reaches 10, output coil C1 is acti-  
vated. Contact C1 in the bottom branch of rung 1 turns on and resets the counter. Out-  
put coil C1 also turns on the first input for the counter in rung 2. Therefore, the counter  
in rung 2 places one count in register R002 for every ten counts in register R1. Input I2  
resets both counters.  
The counters in the Micro PLC can count from 0 to 32767. It may be advantageous, how-  
ever, to structure the counters in an arrangement where the first counter records values  
up to ten thousand. The second counter would then record higher order values (tens of  
thousands, hundreds of thousands, millions, etc.).  
GFK-0804B  
F-4  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
F
Application #4: Industrial “Starting Circuit”  
This logic provides a sample starting circuit for an industrial application. Included in the  
circuit is a simulation of a time delay relay and an emergency stop feature. In your ap-  
plication other safety interlocks may need to be included in the logic. A typical ladder  
logic is shown below.  
Rung 1  
| I2  
I1  
C5  
C4  
+––|/|––+––|+|––+–––––––+––|/|––––+––––––+––()––  
| PB2 | PB1 |  
|
|
|
|
|
|
|
|
|
|
|
|
| C4 |  
+––| |––+  
Rung 2  
| C4  
C5  
ONTMR  
C6  
+––| |––+––|/|––+–––––––+––+–––––––+[R001 ]+––( )––  
|
|
|
|
| I2  
+––||––+–––––––+–––––––+–––+–––––––[00100]  
| PB2 |  
|
|
|
|
|
|
| C6 |  
+––| |––+  
|
Rung 0003  
| I2  
C6  
C5  
+––|/|––+––||––+–––––––+–––––––+–––––––+––()––  
| PB2 |  
|
|
|
|
|
|
|
|
|
|
|
|
|
| C5 |  
+––| |––+  
GFK-0804B  
Appendix F Programming Applications  
F-5  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
F
Rung 4  
| C4  
C5  
O1  
+––||––+––|/|––+––––––––––+–––––––+–––––––+––()––  
|
Rung 5  
| C5  
O2  
+––||––+–––––––+–––––––––––+–––––––+–––––––+––()––  
|
In the logic listed above, push button 1 (PB1), connected to input 1 of the Micro PLC, is  
the start button for an industrial process, while push button 2 (PB2) is the emergency  
stop button connected to input 2. If PB2 is pressed at any time, the process will termi-  
nate. When PB1 is pressed, Coil C4 is activated, which in turn closes contact C4 in rung  
1, latching the circuit. C4 initiates a ten second timer sequence in rung 2. The parameter  
100 in the timer R001 specifies the delay in tenth of a seconds (100 x 0.1 sec = 10 sec).  
Once the time has reached the ten second mark, output coil C6 is turned on. C6 also au-  
tomatically resets the timer by closing contact C6 on the third branch of rung 2. In rung  
3, contact C6 closes, activating output coil C5. Normally closed contact C5 opens in both  
rung 1 and rung 2, disabling the initial start mechanism and the timer.  
Output coil O1 in rung 4, which corresponds to output 1 on the Micro PLC, is activated  
during the 10 second time delay. The output could be used to drive a ”start indicator ”  
light or to begin a process that occurs during the time delay. Output coil O2 in rung 5,  
which corresponds to output 2, is activated at the end of the start–up process. This out-  
put could be used either to start the industrial process itself or to drive a ”run indicator ”  
light.  
GFK-0804B  
F-6  
Micro PLC Programmers Guide – April 1994  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Index  
A
Normally-open, 4-5  
Positive Transition, 4-9  
types of, 4-4  
Analog Expander, scaling and references,  
Counters  
Down Counter, 4-21  
types of, 4-19  
Up Counter, 4-20  
B
C
D
Change directory, A-2  
Coils  
Down Counter, 4-21  
creating with programming software,  
MCR/ End MCRpair, 4-14  
Set/ Resetpair, 4-13  
Skip/ Endpair, 4-15  
types of, 4-11  
E
Emergency stop example, F-5  
Error Codes, RTU Error Responses, C-18  
Communication Errors (RTU), C-18  
Communications, drivers and demo pro-  
F
Communications data format, B-4  
Communications functions  
Microsoft C  
Force Single Output (RTU message), C-13  
Turbo C  
H
Horizontal line in a rung, 2-7 , 2-11  
Compare functions, types of, 4-36  
I
Contacts  
Index-1  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  
Index  
O
Off Timer, 4-18  
Label display, 2-2 , 2-8  
Offline functions of programming soft-  
Labels, create with programming soft-  
On Timer, 4-17  
Ladder logic format, 1-3  
Output  
control reference with Set/ Reset coils,  
Logic Operations  
Exclusive OR, 4-41  
Inclusive OR, 4-40  
types of, 4-38  
Outputs  
P
M
Math functions  
types of, 4-22  
Preset Multiple Registers (RTU message),  
Preset Single Register (RTU message),  
Program, search, programming software,  
Program entry, HHP, 3-3  
insert a rung, 3-4  
Program format, overview, 1-5  
Program listing, HHP, 3-2  
Move functions  
Program syntax, check with programming  
Program transfer, HHP, 3-2  
Programming  
types of, 4-30  
Programming functions  
map of, 2-3  
on HHP, 4-2  
N
Protocol Definition, RTU Protocol, C-1  
GFK-0804B  
Index-2  
Download from Www.Somanuals.com. All Manuals Search And Download.  
 
Index  
Q
delete with HHP, 3-5  
edit with HHP, 3-4 , 3-6  
search with HHP, 3-7  
search with programming software,  
R
Read Analog Inputs (RTU message), C-12  
Read Exception Status (RTU message),  
Read Input Table (RTU message), C-10  
Read Output Table (RTU message), C-9  
Read Registers (RTU message), C-11  
S
Reference, enter with programming soft-  
Search  
with HHP, 3-7  
Report Device Type (RTU Message), C-17  
RTU Character Format, C-4  
RTU Communication Errors, C-18  
Preset Single Register, C-14  
Read Input Table, C-10  
T
Read Output Table, C-9  
Report Device Type, C-17  
Time delay relay example, F-5  
Timers  
RTU Message Fields, C-3  
Error Check Field, C-3  
Information Field, C-3  
creating with programming software,  
Off Timer, 4-18  
On Timer, 4-17  
types of, 4-16  
RTU Message Termination, C-4  
U
RTU Message Types, C-2  
Quer y, C-2  
Up Counter, 4-20  
V
RTU Protocol, C-1 , E-2  
Vertical line in a rung, 2-7  
Rung  
W
Index-3  
GFK-0804B  
Download from Www.Somanuals.com. All Manuals Search And Download.  

Dynex TV DVD Combo DX 24LD230A12 User Manual
Euro Pro Iron GI495H User Manual
Excalibur electronic Radio RD54 User Manual
Fisher Price Crib Toy B3001 User Manual
Fostex Music Pedal FE208 User Manual
Frigidaire Microwave Oven 316495063 User Manual
Fundex Games Board Games 2522 User Manual
Garland Cooktop BH IN 2500 User Manual
Gigabyte Computer Hardware GA P31 ES3G User Manual
Global Machinery Company Grinder BG612HPL User Manual