The text of a manual · part 11 of 53
DL06 Micro PLC User Manual, Volume 1 of 2, pages 100 to 109
Pages 100 to 109 of 524
The original document is the PDF (6.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 AutomationDirect Direct Logic DL06 and Koyo DL06 D0-06DD1
Page 100
Chapter 3: CPU Specifications and Operation
Solve Application Program
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–16
The CPU evaluates each instruction in the application program during this segment of the scan cycle. The instructions define the relationship between the input conditions and the desired output response. The CPU uses the output image register area to store the status of the desired action for the outputs. Output image register locations are designated with a Y followed by a memory location. The actual outputs are updated during the write outputs segment of the scan cycle. There are immediate output instructions available that will update the output points immediately instead of waiting until the write output segment. A complete list of the Immediate instructions is provided in Chapter 5. The internal control relays (C), the stages (S), and the variable memory (V) are also updated in this segment. You may recall that you can force various types of points in the system, discussed earlier in this chapter. If any I/O points or memory data have been forced, the output image register also contains this information.
0V LG Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 G AC(L) AC(N) 24V C0 Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 N.C. OUTPUT: 6-240V
Y
X
0
1
2
50 - 60Hz 3
INPUT: 12 - 24V
4
5
2.0A, 6 - 27V 6
7
10
2.0A 11
12
PWR: 100-240V 13
14
15
16
PWR RUN CPU TX1 RX1 TX2 RX2
50-60Hz 40VA 17
20
D0-06DR
21 22
23
3 - 15mA
LOGIC C0
06
K oyo
X1 X0
X3 X2
X4 C1
X6 X5
X7
C2 X11 X13 X14 X16 C4 X21 X23 N.C. X15 X17 X20 X22 N.C. X10 X12 C3
TERM PORT1
PORT2
RUN STOP
Normal Run mode scan Read Inputs from Specialty I/O Service Peripherals Update Special Relays Solve the Application Program Write Outputs from Specialty I/O Diagnostics
Solve PID Loop Equations The DL06 CPU can process up to 8 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 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.
Write Outputs Once the application program has solved the instruction logic and constructed the output image register, the CPU writes the contents of the output image register to the corresponding output points. Remember, the CPU also made sure that any forcing operation changes were stored in the output image register, so the forced points get updated with the status specified earlier.
Write Outputs to Specialty 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. Specialty modules have built-in microprocessors which communicate to the CPU via the backplane. Some of these mocules can process data. Refer to the specific Specialty module user manual for detailed information.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 101
Chapter 3: CPU Specifications and Operation
Diagnostics During this part of the scan, the CPU performs all system diagnostics and other tasks such as calculating the scan time and resetting the watchdog timer. There are many different error conditions that are automatically detected and reported by the DL06 PLCs. Appendix B contains a listing of the various error codes. Probably one of the more important things that occurs during this segment is the scan time calculation and watchdog timer control. The DL06 CPU has a “watchdog” timer that stores the maximum time allowed for the CPU to complete the solve application segment of the scan cycle. If this time is exceeded the CPU will enter the Program Mode and turn off all outputs. The default value set from the factory is 200 ms. An error is automatically reported. For example, the Handheld Programmer would display the following message “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.
I/O Response Time 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 an input point and update a corresponding output point. In the majority of applications, the CPU performs this task in such a short period of time that you may never have to concern yourself with the aspects of system timing. However, some applications do require extremely fast update times. In these cases, you may need to know how to to determine the amount of time spent during the various segments of operation. There are four things that can affect the I/O response time. • The point in the scan cycle when the field input changes states • Input Off to On delay time • CPU scan time • Output Off to On delay time
The next paragraphs show how these items interact to affect the response time.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
3–17
Page 102
Chapter 3: CPU Specifications and Operation
Normal Minimum I/O Response
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
The I/O response time is shortest when the input changes just before the Read Inputs portion of the execution cycle. In this case the input status is read, the application program is solved, and the output point gets updated. The following diagram shows an example of the timing for this situation. Scan
Scan
Solve Program
Solve Program Read Inputs
Solve Program
Write Outputs
Field Input CPU Reads Inputs
CPU Writes Outputs
Input Off/On Delay
Output Off/On Delay
I/O Response T ime
In this case, you can calculate the response time by simply adding the following items: Input Delay + Scan Time + Output Delay = Response Time
Normal Maximum I/O Response The I/O response time is longest when the input changes just after the Read Inputs portion of the execution cycle. In this case the new input status is not read until the following scan. The following diagram shows an example of the timing for this situation. Scan
Scan
Solve Program
Solve Program Read Inputs
Solve Program
Solve Program
Write Outputs
Field Input CPU Reads Inputs
CPU Writes Outputs
Input Off/On Delay
Output Off/On Delay
I/O Response T ime
In this case, you can calculate the response time by simply adding the following items: Input Delay +(2 x Scan Time) + Output Delay = Response Time
3–18
Solve Program
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 103
Chapter 3: CPU Specifications and Operation
Improving Response Time There are a few things you can do to help improve throughput.
1 • You can use immediate I/O instructions (which update the I/O points during the program 2 execution) • You can use the HSIO Mode 50 Pulse Catch features designed to operate in high-speed environments. See Appendix E for details on using this feature. 3 • You can change Mode 60 filter to 0 msec for X0, X1, X2, and X3. 4 Of these three things the Immediate I/O instructions are probably the most important and most useful. The following example shows how an immediate input instruction 5 and immediate output instruction would affect the response time. 6 7 8 9 10 11 In this case, you can calculate the response time by simply adding the following items. Input Delay + Instruction Execution Time + Output Delay = Response Time 12 The instruction execution time would be calculated by adding the time for the immediate input instruction, the immediate output instruction, and any other instructions in between 13 the two. NOTE: Even though the immediate instruction reads the most current status from I/O, it only uses the results 14 to solve that one instruction. It does not use the new status to update the image register. Therefore, any regular instructions that follow will still use the image register values. Any immediate instructions that follow A will access the I/O again to update the status. B C D • You can choose instructions with faster execution times
Scan
Scan
Solve Program
Normal Read Input
Field Input
Solve Program
Read Input Immediate
Solve Program
Write Output Immediate
Solve Program
Normal Write Outputs
Input Off/On Delay
DL06 Micro PLC User Manual, 3rd Edition Rev. A
3–19
Page 104
Chapter 3: CPU Specifications and Operation
CPU Scan Time Considerations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–20
Power up
The scan time covers all the cyclical tasks that are performed by the operating system. You can use DirectSOFT 5 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 we’ve 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 following are the most important:
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
• Input Update • Peripheral Service
Service peripheral
• Program Execution • Output Update
CPU Bus Communication
• Timed Interrupt Execution
The one you 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 type and peripheral devices can also affect the scan time. However, these things are usually dictated by the application. The following paragraphs provide some general information on how much time some of the segments can require.
Update Clock / Calendar
PGM
Mode? RUN Execute ladder program
PID Equations (DL250)
Update output Write output data to Specialty and Remote I/O
Reading Inputs The time required during each scan to read the input status of built-in inputs is 52.6 µs. Don’t confuse this with the I/O response time that was discussed earlier.
Writing Outputs The time required to write the output status of built-in outputs is 41.1 µS. Don’t confuse this with the I/O response time that was discussed earlier.
Do diagnostics
OK OK?
YES
NO Report the error, set flag, register, turn on LED
NO Fatal error YES Force CPU into PGM mode
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 105
Chapter 3: CPU Specifications and Operation
Service Peripherals Communication requests can occur at any time during the scan, but the CPU only “logs” the requests for service until the Service Peripherals portion of the scan. The CPU does not spend any time on this if there are no peripherals connected. To Log Request (anytime) Nothing Connected
DL06
Min. & Max Send Min. / Max. Rec. Min. / Max. Send Min. / Max. Rec. Min. / Max. Min. / Max.
Port 1 Port 2 LCD
0µs 5.8/11.8 µs 12.5/25.2 µs 6.2/14.3 µs 14.2/31.9 µs 4.8/49.2 µs
During the Service Peripherals portion of the scan, the CPU analyzes the communications request and responds as appropriate. The amount of time required to service the peripherals depends on the content of the request. To Service Request DL06
DL06
Minimum Run Mode Max. Program Mode Max.
9 µs 412 µs 2.5 second
CPU Bus Communication Some specialty modules can also communicate directly with the CPU via the CPU bus. During this portion of the cycle the CPU completes any CPU bus communications. The actual time required depends on the type of modules installed and the type of request being processed.
Update Clock/Calendar, Special Relays, Special Registers The clock, calendar, and special relays are updated and loaded into special V-memory locations during this time. This update is performed during both Run and Program Modes. Modes Program Mode Run Mode
DL06 Minimum Maximum Minimum Maximum
12.0 µs 12.0 µs 20.0 µs 27.0 µs
NOTE: The Clock/Calendar is updated while there is energy on the supercapacitor. If the supercapacitor is discharged, the real time and date is lost.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
3–21
Page 106
Chapter 3: CPU Specifications and Operation
Application Program Execution
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–22
The CPU processes the program from address 0 to the END instruction. The CPU executes the program left to right and top to bottom. As each rung is evaluated the appropriate image register or memory location is updated. The time required to solve the application program depends on the type and number of instructions used, and the amount of execution overhead. Just add the execution times for all the instructions in your program to determine to total execution time. Appendix C provides a complete list of the instruction execution times for the DL06 Micro PLC. For example, the execution time for running the program shown below is calculated as follows: Instruction
Time
STR X0 OR C0 ANDN X1 OUT Y0 STRN C100 LD K10 STRN C101 OUT V2002 STRN C102 LD K50 STRN C103 OUT V2006 STR X5 ANDN X10 OUT Y3 END
.67 .51 .51 1.82 .67 9.00 .67 9.3 .67 9.00 .67 1.82 .67 .51 1.82 12.80
SUBTOTAL
51.11 µs
Overhead Minimum Maximum
µs µs µs µs µs µs µs µs µs µs µs µs µs µs µs µs
X0
X1
Y0 OUT
C0
C100
LD K10
C101
OUT
C102
V2002
LD K50
C103
X5
OUT
X10
DL06 746.2 µs 4352.4 µs
V2006
Y3 OUT
END
TOTAL TIME = (Program execution time + Overhead) x 1.18
The program above takes only 51.11 µs to execute during each scan. The DL06 spends 0.18ms on internal timed interrupt management, for every 1ms of instruction time. The total scan time is calculated by adding the program execution time to the overhead (shown above) and multiplying the result (ms) by 1.18. “Overhead” includes all other housekeeping and diagnostic tasks. The scan time will vary slightly from one scan to the next, because of fluctuation in overhead tasks. Program Control Instructions, the DL06 CPUs offer additional instructions that can change the way the program executes. These instructions include FOR/NEXT loops, Subroutines, and Interrupt Routines. These instructions can interrupt the normal program flow and affect the program execution time. Chapter 5 provides detailed information on how these different types of instructions operate.
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 107
Chapter 3: CPU Specifications and Operation
PLC Numbering Systems octal 1482
BCD
?
binary
If you are a new PLC user or are using ? 0402 ? ? 3 AutomationDirect PLCs for the first time, please take 3A9 7 –961428 ASCII a moment to study how our PLCs use numbers. hexadecimal 1001011011 You’ll find that each PLC manufacturer has their own 177 1011 ? conventions on the use of numbers in their PLCs. decimal A 72B We want to take just a moment to familiarize you ? –300124 with how numbers are used in AutomationDirect PLCs. The information you learn here applies to all of our PLCs! As any good computer does, PLCs store and manipulate numbers in binary form: just ones and zeros. So why do we have to deal with numbers in so many different forms? Numbers have meaning, and some representations are more convenient than others for particular purposes. Sometimes we use numbers to represent a size or amount of something. Other numbers refer to locations or addresses, or to time. In science we attach engineering units to numbers to give a particular meaning (see Appendix I for numbering system details).
1 2 3 4 5 6 PLC Resources 7 PLCs offer a fixed amount of resources, depending on the model and configuration. We use the word “resources” to include variable memory (V-memory), I/O points, timers, counters, 8 etc. Most modular PLCs allow you to add I/O points in groups of eight. In fact, all the resources of our PLCs are counted in octal. It’s easier for computers to count in groups of eight than ten, because eight is an even power of 2 (see Appendix I for more details). 9 Octal means simply counting in groups of eight things Decimal 1 2 3 4 5 6 7 8 at a time. In the figure to the right, there are eight 10 circles. The quantity in decimal is “8”, but in octal it is “10” (8 and 9 are not valid in octal). In octal, “10” Octal 1 2 3 4 5 6 7 10 11 means 1 group of 8 plus 0 (no individuals). In the figure below, we have two groups of eight circles. Counting in octal we have “20” items, meaning 2 groups of eight, plus 0 individuals Don’t say “twenty”, say “two–zero octal”. 12 This makes a clear distinction between number systems. 13 9 10 11 12 13 14 15 16 Decimal 1 2 3 4 5 6 7 8 14 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 Octal After counting PLC resources, it’s time to access PLC resources (there’s a difference). The A CPU instruction set accesses resources of the PLC using octal addresses. Octal addresses are the same as octal quantities, except they start counting at zero. The number zero is significant B to a computer, so we don’t skip it. X= 0 1 2 3 4 5 6 7 Our circles are in an array of square containers to C the right. To access a resource, our PLC instruction X will address its location using the octal references shown. If these were counters, “CT14” would D 1X access the black circle location.
2X
DL06 Micro PLC User Manual, 3rd Edition Rev. A
3–23
Page 108
Chapter 3: CPU Specifications and Operation
V–Memory
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
V-memory address (octal)
LSB Variable memory (V-memory) V2017 0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 1 stores data for the ladder program and for configuration settings. V-memory locations and V-memory addresses are the same thing, and are numbered in octal. For example, V2073 is a valid location, while V1983 is not valid (“9” and “8” are not valid octal digits). Each V-memory location is one data word wide, meaning 16 bits. For configuration registers, our manuals will show each bit of a V-memory word. The least significant bit (LSB) will be on the right, and the most significant bit (MSB) on the left. We use the word “significant”, referring to the relative binary weighting of the bits. V-memory data is 16-bit binary, but we rarely program the data registers one bit at a time. We use instructions or viewing tools that let us work with decimal, octal, and hexadecimal numbers. All these are converted and stored as binary for us. A frequently-asked question is “How do I tell if a number is octal, BCD, or hex”? The answer is that we usually cannot tell just by looking at the data... but it does not really matter. What matters is: the source or mechanism which writes data into a V-memory location and the thing which later reads it must both use the same data type (i.e., octal, hex, binary, or whatever). The V-memory location is just a storage box... that’s all. It does not convert or move the data on its own.
Binary-Coded Decimal Numbers
4
BCD number
9
3
6
Since humans naturally count in 0 1 0 0 1 0 0 1 0 0 1 1 0 1 1 0 decimal (10 fingers, 10 toes), we prefer V-memory storage to enter and view PLC data in decimal as well. However, computers are more efficient in using pure binary numbers. A compromise solution between the two is Binary-Coded Decimal (BCD) representation. A BCD digit ranges from 0 to 9, and is stored as four binary bits (a nibble). This permits each V-memory location to store four BCD digits, with a range of decimal numbers from 0000 to 9999. In a pure binary sense, a 16-bit word can represent numbers from 0 to 65535. In storing BCD numbers, the range is reduced to only 0 to 9999. Many math instructions use BinaryCoded Decimal (BCD) data, and DirectSOFT 5 and the handheld programmer allow us to enter and view data in BCD.
Hexadecimal Numbers Hexadecimal numbers are similar to BCD numbers, except they utilize all possible binary values in each 4-bit digit. They are base-16 numbers so we need 16 different digits. To extend our decimal digits 0 through 9, we use A through F as shown. Decimal Hexadecimal
0 1 2 3 0 1 2 3
4 5 4 5
6 6
7 7
8 9 10 11 12 13 14 15 8 9 A B C D E F
A 4-digit hexadecimal number can represent all 65536 values in a V-memory word. The range is from 0000 to FFFF (hex). PLCs often need this full range for sensor data, etc. Hexadecimal is just a convenient way for humans to view full binary data. Hexadecimal number V-memory storage
3–24
V-memory data (binary)
MSB
A
7
F
4
1 0 1 0
0 1 1 1
1 1 1 1
0 1 0 0
DL06 Micro PLC User Manual, 3rd Edition Rev. A
Page 109
Chapter 3: CPU Specifications and Operation
Memory Map With any PLC system, you generally have many different types of information to process. This includes input device status, output device status, various timing elements, parts counts, etc. It is important to understand how the system represents and stores the various types of data. For example, you need to know how the system identifies input points, output points, data words, etc. The following paragraphs discuss the various memory types used in DL06 Micro PLCs. A memory map overview for the CPU follows the memory descriptions. 0V LG Y0 Y2 C1 Y5 Y7 Y10 Y12 C3 Y15 Y17 G Y1 Y3 Y4 Y6 C2 Y11 Y13 Y14 Y16 N.C. AC(L) AC(N) 24V C0 OUTPUT: 6-240V
Octal Numbering System
Y
X
0
1
2
50 - 60Hz 3
INPUT: 12 - 24V
All memory locations and resources are numbered in Octal (base 8). For example, the diagram shows how the octal numbering system works for the discrete input points. Notice the octal system does not contain any numbers with the digits 8 or 9.
5
2.0A, 6 - 27V 6
7
10
2.0A 11
12
PWR: 100-240V 13
14
15
16
PWR RUN CPU TX1 RX1 TX2 RX2
50-60Hz 40VA 17
20
D0-06DR
21 22
23
3 - 15mA
LOGIC C0
06
K oyo
X1 X0
X0
4
X3 X2
X4 C1
X6 X5
X1
X7
C2 X11 X13 X14 X16 C4 X21 X23 N.C. X10 X12 C3 X15 X17 X20 X22 N.C.
X2
X3
TERM
X4
PORT1
PORT2
RUN STOP
X5
X6
X7
Discrete and Word Locations As you examine the different memory types, you’ll notice two types of memory in the DL06, X10 X11 discrete and word memory. Discrete memory is Discrete – On or Off, 1 bit one bit that can be either a 1 or a 0. Word X0 memory is referred to as V-memory (variable) and is a 16-bit location normally used to manipulate data/numbers, store Word Locations – 16 bits data/numbers, etc. Some information is automatically stored 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 1 in V-memory. For example, the timer current values are stored in V-memory.
V-memory Locations for Discrete Memory Areas The discrete memory area is for inputs, outputs, control relays, special relays, stages, timer status bits and counter status bits. However, you can also access the bit data types as a Vmemory word. Each V-memory location contains 16 consecutive discrete locations. For example, the following diagram shows how the X input points are mapped into V-memory locations. 8 Discrete (X) Input Points X7
Bit # 15
X6
X5
X4
X3
X2
X1
X0
V40400 These discrete memory areas and their corresponding V-memory ranges are listed in the memory area table for DL06 Micro PLCs on the following pages. 14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
DL06 Micro PLC User Manual, 3rd Edition Rev. A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
3–25