The text of a manual · part 14 of 61
DL205 PLC User Manual, Volume 1 of 2: Chapter 3: CPU Specifications and Operations, pages 115 to 124
Pages 115 to 124 of 592, from DL205 PLC User Manual, Volume 1 of 2
The original document is the PDF (13 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 PLC Direct D2-08ND3 and Koyo D2-08ND3
Page 115
Chapter 3: CPU Specifications and Operations
CPU Operation Achieving the proper control for your equipment or process requires a good understanding of how DL205 CPUs control all aspects of system operation. The flow chart below shows the main tasks of the CPU operating system. In this section, we will investigate four aspects of CPU operation: Power up
• CPU Operating System, The CPU manages all aspects of system control.
Initialize hardware
• CPU Operating Modes, The three primary modes of operation are Program Mode, Run Mode, and Test Mode.
Check I/O module config. and verify
• CPU Timing, The two important areas we discuss are the I/O response time and the CPU scan time.
Initialize various memory based on retentive configuration
• CPU Memory Map, The CPUs memory map shows the CPU addresses of various system resources, such as timers, counters, inputs, and outputs.
Update input
CPU Operating System
Read input data from Specialty and Remote I/O
At powerup, the CPU initializes the internal electronic hardware. Memory initialization starts with examining the retentive memory settings. In general, the contents of retentive memory are preserved, and non-retentive memory is initialized to zero (unless otherwise specified). After the one-time powerup tasks, the CPU begins the cyclical scan activity. The flowchart to the right shows how the tasks differ, based on the CPU mode and the existence of any errors. The “scan time” is defined as the average time around the task loop. Note that the CPU is always reading the inputs, even during program mode. This allows programming tools to monitor input status at any time. The outputs are only updated in Run mode. In program mode, they are in the off state. In Run Mode, the CPU executes the user ladder program. Immediately afterwards, any PID loops which are configured are executed (DL250-1 and DL260). Then the CPU writes the output results of these two tasks to the appropriate output points. Error detection has two levels. Non-fatal errors are reported, but the CPU remains in its current mode. If a fatal error occurs, the CPU is forced into program mode and the outputs go off.
Service peripheral
CPU Bus Communication
Update Clock / Calendar
PGM
Mode? RUN Execute ladder program
PID Operations (DL250-1/DL260)
Update output Write output data to Specialty and Remote I/O
Do diagnostics
OK OK?
YES
NO Report the error, set flag, register, turn on LED
NO Fatal error YES Force CPU into PGM mode
DL205 User Manual, 4th Edition, Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
3–21
Page 116
Chapter 3: CPU Specifications and Operations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–22
Program Mode Operation In Program Mode the CPU does not execute X0 Y0 _ X10 _ _ the application program or update the output X7 X17 Y7 modules. The primary use for Program Mode is to enter or change an application program. You also use the program mode to set up CPU parameters, such as the network address, retentive memory areas, etc. Download Program You can use the mode switch on the DL250–1 and DL260 CPUs to select Program Mode operation. Or, with the switch in TERM position, you can use a programming device such as the Handheld Programmer to place the CPU in Program Mode.
Run Mode Operation In Run Mode, the CPU executes the application program, does PID calculations for configured PID loops (DL250-1/DL260), and updates the I/O system. You can perform many operations during Run Mode. Some of these include:
Read Inputs Read Inputs from Specialty I/O Service Peripherals, Force I/O
Monitor and change I/O point status Update timer/counter preset values Update Variable memory locations
CPU Bus Communication Update Clock, Special Relays
Run Mode operation can be divided into several key areas. It is very important you understand Solve the Application Program how each of these areas of execution can affect the results of your application program Solve PID Equations (DL250-1/DL260) solutions. You can use the mode switch to select Run Write Outputs Mode operation (DL240, DL250–1 and DL260). Or, with the mode switch in TERM Write Outputs to Specialty I/O position, you can use a programming device, such as the Handheld Programmer to place the Diagnostics CPU in Run Mode. You can also edit the program during Run Mode. The Run Mode Edits are not “bumpless.” Instead, the CPU maintains the outputs in their last state while it accepts the new program information. If an error is found in the new program, then the CPU will turn all the outputs off and enter the Program Mode. WARNING: Only authorized personnel fully familiar with all aspects of the application should make changes to the program. Changes during Run Mode become effective immediately. Make sure you thoroughly consider the impact of any changes to minimize the risk of personal injury or damage to equipment.
DL205 User Manual, 4th Edition, Rev. A
Page 117
Chapter 3: CPU Specifications and Operations
Read Inputs
1 2 3 4 5 Read Inputs from Specialty and Remote I/O After the CPU reads the inputs from the input 6 modules, it reads any input point data from any Specialty modules that are installed, such as Counter Interface modules, etc. This is also the 7 portion of the scan that reads the input status from Remote I/O bases. 8 NOTE: It may appear the Remote I/O point status is updated every scan. This is not quite true. The CPU will 9 receive information from the Remote I/O Master module every scan, but the Remote Master may not have received an update from all the Remote slaves. Remember, the Remote I/O link is managed by the Remote 10 Master, not the CPU. Service Peripherals and Force I/O 11 After the CPU reads the inputs from the input modules, it reads any attached peripheral devices. This is primarily a communications service for any attached devices. For example, it 12 would read a programming device to see if any input, output, or other memory type status needs to be modified. There are two basic types of forcing available with the DL205 CPUs. 13 NOTE: DirectNet protocol does not support bit operations. • Forcing from a peripheral – not a permanent force, good only for one scan 14 • Bit Override (DL240, DL250–1 and DL260) – holds the I/O point (or other bit) in the current state. Valid bits are X, Y, C, T, CT, and S. (These memory types are discussed in more detail later in A this chapter). Regular Forcing, This type of forcing can temporarily change the status of a discrete bit. B For example, you may want to force an input on, even though it is really off. This allows you to change the point status that was stored in the image register. This value will be valid until the image register location is written to during the next scan. This is primarily useful during C testing situations when you need to force a bit on to trigger another event. D The CPU reads the status of all inputs, then stores it in the image register. Input image register locations are designated with an X followed by a memory location. Image register data is used by the CPU when it solves the application program. Of course, an input may change after the CPU has read the inputs. Generally, the CPU scan time is measured in milliseconds. If you have an application that cannot wait until the next I/O update, you can use Immediate Instructions. These do not use the status of the input image register to solve the application program. The Immediate instructions immediately read the input status directly from I/O modules. However, this lengthens the program scan since the CPU has to read the I/O point status again. A complete list of the Immediate instructions is included in Chapter Five. _
_
_
DL250–1/260
RSSS
_
_
_
DL205 User Manual, 4th Edition, Rev. A
3–23
Page 118
Chapter 3: CPU Specifications and Operations Bit Override, (DL240, DL250–1 and DL260) Bit override can be enabled on a point-by-point basis by using AUX 59 from the Handheld Programmer or, by a menu option from 1 within DirectSOFT. Bit override basically disables any changes to the discrete point by the CPU. For example, if you enable bit override for X1, and X1 is off at the time, then the CPU 2 will not change the state of X1. This means that even if X1 comes on, the CPU will not acknowledge the change. So, if you used X1 in the program, it would always be evaluated as “off ” in this case. Of course, if X1 was on when the bit override was enabled, then X1 would 3 always be evaluated as “on”. There is an advantage available when you use the bit override feature. The regular forcing is not disabled because the bit override is enabled. For example, if 4 you enabled the Bit Override for Y0 and it was off at the time, then the CPU would not change the state of Y0. However, you can still use a programming device to change the status. Now, if you use the programming device to force Y0 on, it will remain on and the CPU will 5 not change the state of Y0. If you then force Y0 off, the CPU will maintain Y0 as off. The CPU will never update the point with the results from the application program or from the 6 I/O update until the bit override is removed. The following diagram shows a brief overview of the bit override feature. Notice the CPU does not update the Image Register when bit override is enabled 7 8 Bit Override OFF Bit Override ON 9 10 CPU Bus Communication 11 Specialty Modules, such as the Data Communications Module, can transfer data to and from the CPU over the CPU bus on the backplane. This data is more than standard I/O point 12 status. This type of communications can only occur on the CPU (local) base. There is a portion of the execution cycle used to communicate with these modules. The CPU performs both read and write requests during this segment. 13 14 A B Update Clock, Special Relays and Special Registers The DL240 , DL250–1 and DL260 CPUs have an internal real-time clock and calendar C timer which is accessible to the application program. Special V-memory locations hold this information. This portion of the execution cycle makes sure these locations get updated on every scan. Also, there are several different Special Relays, such as diagnostic relays, etc., that D are also updated during this segment. Input Update
Input Update
X128 OFF Y128 OFF C377 OFF
Force from Programmer
Result of Program Solution
... ... ... ... ... ...
X2 ON Y2 ON C2 ON
X1 ON Y1 ON C1 OFF
X0 OFF Y0 OFF C0 OFF
Force from Programmer
Result of Program Solution
Image Register (example)
DCM
_
_
DATA
3–24
_
DL205 User Manual, 4th Edition, Rev. A
DCM
_
_
_
Page 119
Chapter 3: CPU Specifications and Operations
Solve Application Program
1 2 3 4 5 6 7 8 The internal control relays (C), the stages (S), and the variable memory (V) are also updated in this segment. 9 You may recall the CPU may have obtained and stored forcing information when it serviced the peripheral devices. If any I/O points or memory data have been forced, the output image register also contains this information. 10 NOTE: If an output point was used in the application program, the results of the program solution will overwrite any forcing information that was stored. For example, if Y0 was forced on by the programming 11 device, and a rung containing Y0 was evaluated such that Y0 should be turned off, then the output image register will show that Y0 should be off. Of course, you can force output points that are not used in the 12 application program. In this case, the point remains forced because there is no solution that results from the application program execution. 13 Solve PID Loop Equations The DL260 CPU can process up to 16 PID loops and the DL250–1 can process up to 4 14 PID loops. The loop calculations are run as a separate task from the ladder program execution, immediately following it. Only loops which have been configured are calculated, and then only according to a built-in loop scheduler. The sample time (calculation interval) of A each loop is programmable. Please refer to Chapter 8, PID Loop Operation, for more on the effects of PID loop calculation on the overall CPU scan time. B Write Outputs Once the application program has solved the instruction logic and constructed the output C image register, the CPU writes the contents of the output image register to the corresponding output points located in the local CPU base or the local expansion bases. Remember, the D CPU also made sure any forcing operation changes were stored in the output image register, The CPU evaluates each instruction in the application program during this segment of the scan cycle. The instructions define the relationship between input conditions and the system outputs. The CPU begins with the first rung of the ladder program, evaluating it from left to right and from top to bottom. It continues, rung by rung, until it encounters the END coil instruction. At that point, a new image for the outputs is complete. X0
X1
Y0 OUT
C0
Read Inputs
Read Inputs from Specialty I/O Service Peripherals, Force I/O CPU Bus Communication
Update Clock, Special Relays
Solve the Application Program
Solve PID equations (DL250-1/DL260)
C100
LD
K10
X5
X10
Write Outputs
Y3 OUT
Write Outputs to Specialty I/O
END
Diagnostics
230 240
250-1 260 so the forced points get updated with the status specified earlier.
DL205 User Manual, 4th Edition, Rev. A
3–25
Page 120
Chapter 3: CPU Specifications and Operations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–26
Write Outputs to Specialty and Remote I/O After the CPU updates the outputs in the local and expansion bases, it sends the output point information that is required by any Specialty modules which are installed. For example, this is the portion of the scan that writes the output status from the image register to the Remote I/O racks. NOTE: It may appear the Remote I/O point status is updated every scan. This is not quite true. The CPU will send the information to the Remote I/O Master module every scan, but the Remote Master will update the actual remote modules during the next communication sequence between the master and slave modules. Remember, the Remote I/O link communication is managed by the Remote Master, not the CPU.
Diagnostics During this part of the scan, the CPU performs all system diagnostics and other tasks, such as: • calculating the scan time
Read Inputs Read Inputs from Specialty I/O
• updating special relays • resetting the watchdog timer
Service Peripherals, Force I/O
DL205 CPUs automatically detect and report CPU Bus Communication many different error conditions. Appendix B contains a listing of the various error codes Update Clock, Special Relays available with the DL205 system. One of the more important diagnostic tasks is the Solve the Application Program scan time calculation and watchdog timer control. DL205 CPUs have a “watchdog” timer that stores Solve PID Loop Equations the maximum time allowed for the CPU to complete the solve application segment of the Write Outputs scan cycle. The default value set from the factory is 200 mS. If this time is exceeded the CPU will Write Outputs to Specialty I/O enter the Program Mode, turn off all outputs, and report the error. For example, the Handheld Diagnostics Programmer displays “E003 S/W TIMEOUT” when the scan overrun occurs. You can use AUX 53 to view the minimum, maximum, and current scan time. Use AUX 55 to increase or decrease the watchdog timer value. There is also an RSTWT instruction that can be used in the application program to reset the watch dog timer during the CPU scan.
DL205 User Manual, 4th Edition, Rev. A
Page 121
Chapter 3: CPU Specifications and Operations
I/O Response Time
1 Is Timing Important for Your Application? I/O response time is the amount of time required for the control system to sense a change in 2 an input point and update a corresponding output point. In the majority of applications, the CPU performs this task practically instantaneously. However, some applications do require 3 extremely fast update times. There are four things that can affect the I/O response time: • The point in the scan period when the field input changes states 4 • Input module Off to On delay time • CPU scan time 5 • Output module Off to On delay time Normal Minimum I/O Response 6 The I/O response time is shortest when the module senses the input change before the Read Inputs portion of the execution cycle. In this case the input status is read, the application 7 program is solved, and the output point gets updated. The following diagram shows an example of the timing for this situation. 8 9 10 11 12 13 14 In this case, you can calculate the response time by simply adding the following items: A Input Delay + Scan Time + Output Delay = Response Time B Normal Maximum I/O Response The I/O response time is longest when the module senses the input change after the Read Inputs portion of the execution cycle. In this case the new input status does not get read until C the following scan. The following diagram shows an example of the timing for this situation. In this case, you can calculate the response time by simply adding the following items: D Input Delay +(2 x Scan Time) + Output Delay = Response Time Scan
Scan
Solve Program
Solve Program
Read Inputs
Solve Program
Solve Program
Write Outputs
Field Input
Input Module Off/On Delay
CPU Reads Inputs
CPU Writes Outputs
Output Module Off/On Delay
I/O Response Time
DL205 User Manual, 4th Edition, Rev. A
3–27
Page 122
Chapter 3: CPU Specifications and Operations Scan
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Solve Program
Solve Program
Scan
Read Inputs
Solve Program
Solve Program
Write Outputs
Field Input CPU Reads Inputs
Input Module Off/On Delay
CPU Writes Outputs
Output Module Off/On Delay I/O Response Time
Improving Response Time There are a few things you can do the help improve throughput. • Choose instructions with faster execution times • Use immediate I/O instructions (which update the I/O points during the ladder program execution segment) • Choose modules that have faster response times Immediate I/O instructions are probably the most useful technique. The following example shows immediate input and output instructions, and their effect. Scan Solve Program
Scan
Normal Read Input
Solve Program Read Input Immediate
Solve Program Write Output Immediate
Solve Program
Normal Write Outputs
Field Input Input Module Off/On Delay Output Module Off/On Delay
3–28
I/O Response Time
In this case, you can calculate the response time by simply adding the following items: Input Delay + Instruction Execution Time + Output Delay = Response Time
The instruction execution time is calculated by adding the time for the immediate input instruction, the immediate output instruction, and all instructions in between. NOTE: When the immediate instruction reads the current status from a module, it uses the results to solve that one instruction without updating the image register. Therefore, any regular instructions that follow will still use image register values. Any immediate instructions that follow will access the module again to update the status.
DL205 User Manual, 4th Edition, Rev. A
Page 123
Chapter 3: CPU Specifications and Operations
CPU Scan Time Considerations The scan time covers all the cyclical tasks that are performed by the operating system. You can use DirectSOFT or the Handheld Programmer to display the minimum, maximum, and current scan times that have occurred since the previous Program Mode to Run Mode transition. This information can be very important when evaluating the performance of a system. As shown previously, there are several segments that make up the scan cycle. Each of these segments requires a certain amount of time to complete. Of all the segments, the only one you really have the most control over is the amount of time it takes to execute the application program. This is because different instructions take different amounts of time to execute. So, if you think you need a faster scan, then you can try to choose faster instructions. Your choice of I/O modules and system configuration, such as expansion or remote I/O, can also affect the scan time; however, these things are usually dictated by the application. For example, if you have a need to count pulses at high rates of speed, then you’ll probably have to use a High-Speed Counter module. Also, if you have I/O points that need to be located several hundred feet from the CPU, then you need remote I/O because it’s much faster and cheaper to install a single remote I/O cable than it is to run all those signal wires for each individual I/O point. The following paragraphs provide some general information on how much time some of the segments can require.
Power up
Initialize hardware Check I/O module config. and verify Initialize various memory based on retentive configuration
Update input Read input data from Specialty and Remote I/O Service peripheral
CPU Bus Communication
Update Clock / Calendar
PGM
Mode? RUN Execute ladder program
PID Equations (DL250-1/DL260)
Update output Write output data to Specialty and Remote I/O
Do diagnostics
OK OK?
YES
NO Report the error, set flag, register, turn on LED
NO Fatal error YES
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Force CPU into PGM mode
DL205 User Manual, 4th Edition, Rev. A
3–29
Page 124
Chapter 3: CPU Specifications and Operations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
Initialization Process The CPU performs an initialization task once the system power is on. The initialization task is performed once at power-up, so it does not affect the scan time for the application program. Initialization Minimum Time Maximum Time
DL230
DL240
1.6 Seconds 3.6 Seconds
1.0 Seconds 2.0 Seconds
DL250–1
DL260
1.2 Seconds 2.7 Seconds(w/ 2 exp. bases)
1.2 Seconds 3.7 Seconds (w/ 4 exp. bases)
Reading Inputs The time required to read the input status for the input modules depends on which CPU you are using and the number of input points in the base. The following table shows typical update times required by the CPU. Timing Factors Overhead Per input point
3–30
DL230 64.0 µs 6.0 µs
DL240 32.0 µs 12.3 µs
DL250–1 12.6 µs 2.5 µs
DL260 12.6 µs 2.5 µs
For example, the time required for a DL240 to read two 8-point input modules would be calculated as follows, where NI is the total number of input points: Formula Time = 32µs + (12.3 x NI) Example Time = 32µs + (12.3 x 16) Time = 228.8 µs NOTE: This information provides the amount of time the CPU spends reading the input status from the modules. Don’t confuse this with the I/O response time that was discussed earlier.
DL205 User Manual, 4th Edition, Rev. A