The text of a manual · part 8 of 19
Classic 1785 PLC-5 Programmable Controllers User Manual (1785-LT, -LT2, -LT3, -LT4), pages 71 to 80
Pages 71 to 80 of 186
The original document is the PDF (1.4 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Allen-Bradley 1785-LT2, Allen-Bradley 1785-LT3, Allen-Bradley 1785-LT4 and Allen-Bradley 1785-LT B
Page 71
Chapter 5 Choosing Communication
Figure 5.11 1785-KE (Series B) Connection through an RS-232-C Serial Port DH+ link
T53 serial port COM1 or COM2
1785-KE Series B
PLC-5/10, -5/12, -5/15, or -5/25 processor
Figure 5.12 1770-KF2/B Connection through an RS-232-C Serial Port DH+ link
1770-KF2/B
T53 serial port COM1 or COM2
PLC-5/10, -5/12, -5/15, or -5/25 processor
5-13
Page 72
Chapter
6
Planning Your System Programs
Chapter Objectives
This chapter covers basic programming considerations for planning a Classic PLC-5 programmable controller system. System Design Determined If you want to read about:
Go to page:
Planning application programs
6-1
Using SFCs
6-1
Preparing programs for your application
6-3
Addressing the data table
6-7
Using the processor status file
6-9
Choosing Hardware Placing System Hardware Assigning Addressing Mode, Racks, and Groups
Selecting Interrupt Routines Transferring Discrete and Block Data Calculating Program Timing
Choosing Communication Planning Your System Programs
See your programming software documentation for a discussion of the instructions used in ladder-logic programming.
Planning Application Programs
Use the functional specification that you previously developed to define your programming application. The specification is a conceptual view of your application and is used to determine your main program, sequential function chart (SFC), and logic requirements. In planning and developing the programs for your application, we recommend that you use the program-development model shown in chapter 1, “Understanding Your System.”
Using SFCs with PLC-5 Processors
Use SFCs as a sequence-control language by which you can control and display the state of a control process. Instead of one long program for your application, divide the logic into steps and transitions. The display of these steps and transitions lets the user see what state the machine process is in at a given time.
6-1
Page 73
Chapter 6 Planning Your System Programs
002
Initial Step 003 005
004 006 008
007 009
010
011
012 013 014 015
Each step corresponds to a control task (displayed as a box); each step is related to a program file that contains the logic for the associated control task. Each transition (displayed as a horizontal line) examines conditions, specified in an associated program file, that determines when the processor can continue to the next task.
Deciding How to Use an SFC After you identify the major areas of machine operation, convert the logical paths and steps that you labeled in your design specification to SFC building blocks. Table 6.A helps explain when to use which SFC building blocks. Important: At this point, do not worry about the actual logic for each step and transition. After you complete the SFC, you can develop the logic. Table 6.A Deciding When to Use the SFC Structures
If you have:
Then draw:
Using these rules:
An independent machine state
A step with its transition
A step must always be followed by a transition.
A clearly defined chain of events that occur sequentially
A simple path of steps and transitions
For design purposes, number steps and transitions consecutively from 2.
For example, in one heat-treating area, the temperature must ramp up at a particular rate; maintain the temperature for a certain duration, then cool at a particular rate. Two or more alternative paths where only one is selected
Start the path with a step; end the path with a transition.
A selection branch
The transitions beginning each path are scanned from left to right. The first true transition determines the path taken.
A simultaneous branch
All paths are active in the structure.
For example, depending on a build code, one station must either drill or polish. Two or more parallel paths that must be scanned simultaneously at least once For example, communications and block transfers must occur while control logic is executing.
6-2
You can define up to 7 parallel paths.
Page 74
Chapter 6 Planning Your System Programs
Application Example for SFCs For typical SFC applications, an SFC program controls the order of events in your process by issuing commands. A command, such as fwdcyr_cmd to move a conveyor forward, is simply a data table storage bit (for example B3:0/7) that you set up in the SFC. You then program the logic for fwdcyr_cmd in a separate ladder program to control the actual outputs to move the conveyor. You can have only one main program file, which is either an SFC or a ladder-logic program. You enter the programs into your computer using the SFC or ladder editor. For more information on entering SFCs or ladder logic, see your programming software documentation set.
Programming Considerations for SFCs Use the information in Table 6.B for SFC rules for special programming. Table 6.B SFC Rules for Special Programming Considerations If you have:
Use these rules:
To jump within the SFC
Use a GOTO statement and label.
A step that needs to be run in multiple places within the SFC
Repeat the step where needed or use a global subroutine that gets called from multiple steps.
A step that can be ignored based on logic conditions
Create two selection branches, one with and one without the step; or place the step in a subroutine; or combine the step with another step that is segregated by an MCR zone.
An SFC branch structure within another branch structure (nesting)
Nest the branch structures. The software supports as many levels of nested branches as you can store based on processor memory.
A mini-SFC (compressed steps) within the main SFC
Create an SFC macro. A macro begins a with a step; the transition for the ending step follows the macro.
To reset the logic in an SFC program
Set the SFR instruction to reset the chart.
To disable an MCP
Set the disable bit on the Processor Configuration screen.
See your programming software documentation for further information on any of the techniques listed in this table.
Preparing the Programs for Your Application
This section uses a drill-machine application example. Information on the program entry phase is in the programming software documentation set. You can use only one main program; but you can still apply some of the steps by incorporating them into your main SFC and supporting ladder programs.
6-3
Page 75
Chapter 6 Planning Your System Programs
Organizing a Machine Example This section uses an example of a specific machine operation to show how to identify conditions and actions and how to group the actions into steps of machine operation. Figure 6.1 Hardware Block Diagram and Description of Machine Process L oad S t a t i on
O FF AUTO
FW D
FW D
C onveyor M otor FW D
A dvance A ssem bly
D rill M oto r
C lam p
LS 1 N . O.
N . C . LS 2
C L1 LS 3
N. O.
H e ld O pen
N. O. LS 4 LS 5 N . O. U n l oad S t a t i on
A description of this operation might be as follows: 1. 2. 3. 4.
5.
6-4
The operator starts the conveyor by selecting AUTO. The operator puts a block of wood onto the conveyor. The wood moves into position and actuates LS1. When the wood is in position: a. the conveyor stops b. CL1 clamps the wood c. the drill station moves forward The drill station moves forward and closes LS3. This action turns on the drill motor.
6.
7. 8. 9.
10.
The drill station moves to full depth and closes LS4. This action: a. stops forward motion of the drill station b. initiates a 2-second dwell The drill station backs up after the 2-second dwell. The drill motor stops when LS3 is released. The drill station reaches home position and opens LS2. This action: a. stops the reverse motion b. opens the clamp c. starts the conveyor forward The wood is ejected when LS5 toggles to indicate that the cycle is complete.
Page 76
Chapter 6 Planning Your System Programs
We recommend that you then create a rough-draft SFC to represent the operation (see Figure 6.2). Figure 6.2 Drill Machine Example Functional Specification
Step Transition initialization
010
AUTO operator starts cycle conveyor forward 011
LS1 wood in position drill
012
LS4 hole drilled dwell 013
TMR1 dwell timer done reverse drill 014
LS2 station home eject 015
LS5 wood ejected
Creating the Detailed Analysis for Your Functional Specification Begin determining the details of your process as discussed in chapter 1, “Understanding Your System.” Identify the hardware requirements. Table 6.C identifies hardware requirements for the inputs and outputs of the drill machine.
6-5
Page 77
Chapter 6 Planning Your System Programs
Table 6.C Hardware Requirements for the Inputs and Output of the Drill Example Input
Part
Description
AUTO selector switch select automatic mode
LS1
N.O.
limit switch part in place
LS2
N.C.
limit switch drill station home
LS3
N.O.
limit switch drill motor on
LS4
N.O.
limit switch drill station at full depth
LS5
N.O.
limit switch cycle complete
DSF drive motor move drill station forward
DSB drive motor move drill station back
DM drill motor drill motor on
CL1 electric clamp clamp 1 on
CMF drive motor move conveyor forward
TMR1 timer dwell timer
Use the hardware requirements (with the functional specification) to match the inputs and outputs with the actions of the process. Table 6.D shows the hardware requirements with the general description of the drill machine example. Table 6.D List of Conditions and Actions for the Drill Example
6-6
When this happens:
This happens:
AUTO switch closes
Conveyor moves forward
(CMF = on)
LS1 closes
Conveyor stops Clamp holds wood Drill station advances
(CMF = off) (CL1 = on) (DSF = on)
LS3 closes
Drill motor starts
(DM = on)
LS4 closes
Drill station stops Dwell timer starts
(DSF = off) (TMR1 = on)
Timer done
Drill station backs up
(DSB = on)
LS3 opens
Drill motor stop
(DM = off)
LS2 opens
Drill station stops Clamp releases wood Conveyor starts
(DSB = off) (CL1 = off) (CMF = on)
LS5 closes
Wood is ejected
Page 78
Chapter 6 Planning Your System Programs
Once you identify the individual actions, you can add these actions to your plan to complete your program. Once you have an SFC program that defines the individual machine actions for your process, you can create a ladder-logic program that controls the outputs of those machine actions. It does not matter in what order you program these rungs. This program merely contains the ladder logic that defines a command for each machine action in your process.
Program Entry When you finish your detailed analysis, you have your main program planned. Now, enter your program into your terminal.
Addressing Data Table Files
Input Data
DATA STORAGE I/O Image Files Block-Transfer Files Other Data Files
Examine Data
Output Data
PLC-5 memory is divided into two areas: data and program-file storage.
Areas of Storage
Description
Data
All of the data the processor examines or changes is stored in files in data storage areas of memory. These storage areas store: • Data received from input modules • Data to be sent to output modules; this data represents decisions made by the logic • Intermediate results made by the logic • Preloaded data such as presets and recipes • Control instructions • System status
Program Files
You create files for program logic, depending on the method you are using: ladder logic, sequential function charts, and/or structured text. These files contain the instructions to examine inputs and outputs and return results.
Return Results
PROGRAM FILES
Data Table Memory You can address data files in different formats when you write your programs. Refer to Table 6.E for valid data table file-type specifications.
6-7
Page 79
Chapter 6 Planning Your System Programs
Table 6.E Data Table Memory Usage File Type
File Type Identifier
File Number
Memory Used in Over- head for Each File (16-bit words)
Memory Used (16-bit words) per Word, Float Word, Character, or Structure
Output Image
O
0
2
1/word
Input Image
I
1
2
1/word
Status
S
2
2
1/word
Bit (binary)
B
3
2
1/word
Timer
T
41
2
3/structure
Counter
C
51
2
3/structure
Control
R
61
2
3/structure
Integer
N
71
2
1/word
Floating-Point
F
81
2
2/float word
ASCII
A
3-999
2
1/ per character 2
BCD
D
3-999
2
1/word
Undefined
--
9-999
2
0
1 This is the default file number. For this file type, you can assign any file number from 3 thru 999.
Data table files are contiguous in memory. Size in words for I/O files 0 and 1 are: For this processor:
Files O0 and I1 memory size:
PLC-5/10, -5/12, -5/15
Is fixed at 32 words
PLC-5/25
Varies from 32-64 words (32 is the default)
Status file 2 is fixed at 32 words for each processor. Files 3-999 vary in size. These files contain only the number of words corresponding to the highest address that you assign. Each B, N, A, and D file can be 1,000 words maximum. Each F file can be 1,000 float words (32-bit words) maximum. Each T, C, R, and SC file can be 1,000 structures maximum.
6-8
Page 80
Chapter 6 Planning Your System Programs
Data Table Addressing Formats Address Type
Description
Example
Logical address
Alpha-numeric coded format to specify the data location
N23:0 addresses an integer file 23, word 0
I/O image address
Logical address format, but relates physical locations in the I/O chassis to memory locations in the I/O image file
I:017/17 addresses input file word 017 (octal), bit 17 (octal), which corresponds to rack 01, module group 7, and terminal 17
Indirect address
Logical address format, but allows you to change address values in the base address with your ladder logic program
N[N7:6]:0 has the file number as the variable The file number is stored in integer file 7, word 6
Indexed address
Index prefix (#) is followed by a logical address format, but it adds an index value (offset) from processor status file to the base address
When #N23:0 is the indexed address and the offset value stored in the processor status file is 10, then • the base address is integer file 23, word 0 • and the offset address is integer file 23, word 10
Symbolic address
ASCII character string that relates the address (file, structure, word, or bit) to a descriptive, meaningful name that you assign
For example, a floating point address F10:0 could be given a symbolic address of Calc_1. These symbols are a feature of the programming software and not of the processor. Guidelines for setting up an address are as follows: • Start the name with an alphabetic character. • The symbol must begin with a letter and can have up to 10 of the following characters: A-Z (upper and lower case), 0-9, underscore (_) and @. • You can substitute a symbolic address for structure, word, or bit addresses. • Record the symbols you define and their corresponding logical addresses.
Using the Processor Status File
Use the Processor Status screen to monitor: processor status information major and minor faults STIs program scan times I/O status Processor status data is stored in status file S2. See Table 6.F.
6-9