The text of a manual · part 11 of 40
DL05 Micro PLC User Manual, Volume 1 of 2: Chapter 3: CPU Specifications and Operation, pages 90 to 98
Pages 90 to 98 of 379, from DL05 Micro PLC User Manual, Volume 1 of 2
The original document is the PDF (5.8 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 D0-05AA
Page 90
Chapter 3: CPU Specifications and Operation
Application Program Execution
1 2 3 4 5 6 7 8 9 10 11 12 13 The program above takes only 174.2 µs to execute during each scan. The DL05 spends 0.1 ms, on internal timed interrupt management, for every 1.0 ms of instruction time. The 14 total scan time is calculated by adding the program execution time to the overhead (shown above) and multiplying the result (ms) by 1.1. “Overhead” includes all other housekeeping and diagnostic tasks. The scan time will vary slightly from one scan to the next, because of A fluctuation in overhead tasks. Program Control Instructions, the DL05 PLCs have an interrupt routine feature that B changes the way a program executes. Since this instruction interrupts normal program flow, it will have an effect on the program execution time. For example, a timed interrupt routine C with a 10.0 ms period interrupts the main program execution (before the END statement) every 10.0 ms, so the CPU can execute the interrupt routine. Chapter 5 provides detailed information on interrupts. D 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 DL05 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
2.0 µs 1.6 µs 1.6 µs 6.8 µs 2.3 µs 42.7 µs 2.3 µs 16.6 µs 2.3 µs 42.7 µs 2.3 µs 16.6 µs 2.0 µs 1.6 µs 6.8 µs 24.0 µs
SUBTOTAL
174.2 µs
Overhead Minimum Maximum
X0
X1
Y0 OUT
C0
C100
LD
C101
OUT V2002
C102
LD
C103
X5
DL05 0.66 µs 2.5 µs
K10
K50
OUT V2006
X10
Y3 OUT
END
TOTAL TIME = (Program execution time + Overhead) x 1.1
DL05 Micro PLC User Manual, 6th Edition, Rev. A
3–19
Page 91
Chapter 3: CPU Specifications and Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–20
PLC Numbering Systems octal binary
BCD ? If you are a new PLC user or are using AutomationDirect 1482 ? 0402 ? ? 3 PLCs for the first time, please take a moment to study how 3A9 our PLCs use numbers. You’ll find that each PLC 7 –961428 ASCII hexadecimal manufacturer has their own conventions on the use of 1001011011 177 1011 numbers in their PLCs. We want to take just a moment to ? decimal familiarize you with how numbers are used in A 72B ? –300124 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).
PLC Resources 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, 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. Decimal 1 2 3 4 5 6 7 8 Octal means simply counting in groups of eight things at a time. In the figure to the right, there are eight circles. The quantity in decimal is “8”, but in Octal 1 2 3 4 5 6 7 10 octal it is “10” (8 and 9 are not valid in octal). In octal, “10” 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”. This makes a clear distinction between number systems.
Decimal 1 2 3 4 5 6 7 8
Octal
1
2 3 4
5
6
7 10
9 10 11 12 13 14 15 16
11 12 13 14 15 16 17 20
After counting PLC resources, it is time to access PLC resources (there is a difference). The 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 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 the right. To access a resource, our PLC instruction X will address its location using the octal references 1X shown. If these were counters, “CT14” would access the black circle location. 2X DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 92
Chapter 3: CPU Specifications and Operation
V–memory
1 2 3 4 5 6 7 8 9 Binary-Coded Decimal Numbers Since humans naturally count in decimal (10 fingers, 10 toes), we prefer 10 to enter and view PLC data in decimal as well. However, computers are more efficient in using pure binary numbers. A compromise 11 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 12 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 Binary- 13 Coded Decimal (BCD) data, and DirectSOFT 5 and the handheld programmer allow us to enter and view data in BCD. 14 Hexadecimal Numbers Hexadecimal numbers are similar to BCD numbers, except they utilize all possible binary A 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. B C 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 D is just a convenient way for humans to view full binary data. V-memory address
V-memory data
(octal) (binary) MSB LSB Variable memory (called 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.
BCD number
V-memory storage
Decimal Hexadecimal
0 1 2 3 0 1 2 3
Hexadecimal number V-memory storage
4 5 4 5
6 6
7 7
4
9
3
6
0 1 0 0
1 0 0 1
0 0 1 1
0 1 1 0
8 9 10 11 12 13 14 15 8 9 A B C D E F
A
7
F
4
1 0 1 0
0 1 1 1
1 1 1 1
0 1 0 0
DL05 Micro PLC User Manual, 6th Edition, Rev. A
3–21
Page 93
Chapter 3: CPU Specifications and Operation
Map 1 Memory 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, 2 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 DL05 3 Micro PLCs. A memory map overview for the CPU follows the memory descriptions. 4 Octal Numbering System All memory locations and resources are numbered 5 in Octal (base 8). For example, the diagram shows how the octal numbering system works for the 6 discrete input points. Notice the octal system does not contain any numbers with the digits 8 or 9. 7 Discrete and Word Locations As you examine the different memory types, you’ll 8 notice two types of memory in the DL05, discrete and word memory. Discrete memory is one bit that can be either a 1 or a 0. Word memory is 9 referred to as V-memory (variable) and is a 16-bit location normally used to manipulate Word Locations – 16 bits 10 data/numbers, store data/numbers, etc. Some information is automatically stored in 0 1 0 1 0 0 0 0 0 0 1 0 0 1 0 1 11 V-memory. For example, the timer current values are stored in V-memory. 12 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 V13 memory 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 14 locations. 8 Discrete (X) Input Points A B C Bit # V40400 D These discrete memory areas and their corresponding V-memory ranges are listed in the X0
X1
X2
X3
X4
X5
X6
Discrete – On or Off, 1 bit X0
15
14
13
12
11
10
9
8
X7
X6
X5
X4
X3
X2
X1
X0
7
6
5
4
3
2
1
0 memory area table for DL05 Micro PLCs on the following pages.
3–22
DL05 Micro PLC User Manual, 6th Edition, Rev. A
X7
Page 94
Chapter 3: CPU Specifications and Operation
Input Points (X Data Type) The discrete input points are noted by an X data type. There are 8 discrete input points and 256 discrete input addresses available with DL05 CPUs. In this example, the output point Y0 will be turned on when input X0 energizes.
X0
Y0 OUT
X1
Y1 OUT
X6
C5 OUT
C5
Y10 OUT
Output Points (Y Data Type) The discrete output points are noted by a Y data type. There are 6 discrete outputs and 256 discrete output addresses available with DL05 CPUs. In this example, output point Y1 will be turned on when input X1 energizes.
Control Relays (C Data Type) Control relays are discrete bits normally used to control the user program. The control relays do not represent a real world device, that is, they cannot be physically tied to switches, output coils, etc. They are internal to the CPU. Because of this, control relays can be programmed as discrete inputs or discrete outputs. These locations are used in programming the discrete memory locations (C) or the corresponding word location which contains 16 consecutive discrete locations. In this example, memory location C5 will energize when input X6 turns on. The second rung shows a simple example of how to use a control relay as an input.
Y20 OUT
Timers and Timer Status Bits (T Data Type) Timer status bits reflect the relationship between the current value and the preset value of a specified timer. The timer status bit will be on when the current value is equal or greater than the preset value of a corresponding timer. When input X0 turns on, timer T1 will start. When the timer reaches the preset of 3 seconds (K30) timer status contact T1 turns on. When T1 turns on, output Y12 turns on. Turning off X0 resets the timer.
X0
TMR
T1 K30
T1
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Y12 OUT
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
3–23
Page 95
Chapter 3: CPU Specifications and Operation
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D 3–24
Timer Current Values (V Data Type) As mentioned earlier, some information is automatically stored in V-memory. This is true for the current values associated with timers. For example, V0 holds the current value for Timer 0, V1 holds the current value for Timer 1, etc. The primary reason for this is programming flexibility. The example shows how you can use relational contacts to monitor several time intervals from a single timer.
X0
TMR T1 K1000
V1
K30
Y2 OUT
V1
K50
Y3 OUT
V1
K75
V1
K100
Y4 OUT
Counters and Counter Status Bits (CT Data type) Counter status bits that reflect the relationship between the current value and the preset value of a specified counter. The counter status bit will be on when the current value is equal to or greater than the preset value of a corresponding counter. Each time contact X0 transitions from off to on, the counter increments by one. (If X1 comes on, the counter is reset to zero.) When the counter reaches the preset of 10 counts (K of 10) counter status contact CT3 turns on. When CT3 turns on, output Y2 turns on.
X0
CNT
CT3 K10
X1
Y2 OUT
CT3
Counter Current Values (V Data Type) Just like the timers, the counter current values are also automatically stored in V-memory. For example, V1000 holds the current value for Counter CT0, V1001 holds the current value for Counter CT1, etc. The primary reason for this is programming flexibility. The example shows how you can use relational contacts to monitor the counter values.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
X0
CNT
CT3 K10
X1
V1003
K1
Y2 OUT
V1003
K3
Y3 OUT
V1003
K5
V1003
K8
Y4 OUT
Page 96
Chapter 3: CPU Specifications and Operation
Word Memory (V Data Type)
1 2 3 4 Word Locations – 16 bits 0 0 0 1 00 11 0 1 0 0 0 1 0 1 5 Stages (S Data type) Stages are used in RLL programs to create a 6 1 3 4 5 structured program, similar to a flowchart. Each program Stage denotes a program segment. When the program Ladder Representation segment, or Stage, is active, the logic within that segment 7 is executed. If the Stage is off, or inactive, the logic is not executed and the CPU skips to the next active Stage. (See 8 Chapter 7 for a more detailed description of RLL programming.) 9 Each Stage also has a discrete status bit that can be used as an input to indicate whether the Stage is active or inactive. If the Stage is active, then the status bit is on. If 10 the Stage is inactive, then the status bit is off. This status bit can also be turned on or off by other instructions, 11 such as the SET or RESET instructions. This allows you to easily control stages throughout the program. 12 13 14 Special Relays (SP Data Type) Special relays are discrete memory locations with pre-defined A functionality. There are many different types of special relays. For example, some aid in program development, others provide B system operating status information, etc. Appendix D provides a complete listing of the special relays. C In this example, control relay C10 will energize for 50 ms and de-energize for 50 ms because SP5 is a pre–defined relay that will be on for 50 ms and off for 50 ms. D Word memory is referred to as V-memory (variable) and is a 16-bit location normally used to manipulate data/numbers, store data/numbers, etc. Some information is automatically stored in V-memory. For example, the timer current values are stored in V-memory. The example shows how a fourdigit BCD constant is loaded into the accumulator and then stored in a V-memory location.
X0
LD
K1345
OUT V2000
PLUS
ISG S0000
PLUS
Wait for Start
Start
S1 JMP
X0
SG
S500 JMP
Check for a Part
S0001
Part Present X1
Part Present
S2 JMP S6 JMP
X1
SG
Clamp the part
S0002
Part Locked
Clamp SET S400 S3 JMP
X2
SP5
C10 OUT
SP4: 1 second clock SP5: 100 ms clock
SP6: 50 ms clock
DL05 Micro PLC User Manual, 6th Edition, Rev. A
3–25
Page 97
Chapter 3: CPU Specifications and Operation
1 DL05 System V-memory System Parameters and Default Data Locations (V Data Type) 2 The DL05 PLCs reserve several V-memory locations for storing system parameters or certain types of system data. These memory locations store things like the error codes, High-Speed I/O data, and other types of system setup information. 3 System Default Description of Contents 4 V-memory Values/Ranges V2320–V2377 5 V7620–V7627 Locations for DV–1000 operator interface parameters V7620 V7621 6 V7622 V7623 7 V7624 V7625 8 V7626 V7627 9 10 V7630 11 V7631–V7632 12 13 V7633 14 A - X0 B V7634 V7635 - X1 V7636 - X2 C V7637 V7640–V7646 D V7647 The default location for multiple preset values for the High-Speed Counter Sets the V-memory location that contains the value
V0 – V2377
Sets the V-memory location that contains the message
V0 – V2377
Sets the total number (1 – 16) of V-memory locations to be displayed.
1 – 16
Sets the V-memory location containing the numbers to be displayed.
V0 – V2377
Sets the V-memory location containing the character code to be displayed
V0 – V2377
Contains the function number that can be assigned to each key.
V-memory location for X, Y, or C points used
Power-up operational mode. Change preset value.
0, 1, 2, 12, 3 0000 to 9999
Starting location for the multi–step presets for channel 1. The default value is 2320, which indicates the first value should be obtained from V2320. Since there are 24 presets available, the default range is V2320 – V2377. You can change the starting point if necessary. Reserved
3–26
Default: V2320 Range: V0 – V2320 N/A
Sets the desired function code for the high speed counter, interrupt, pulse catch, pulse train, and input filter. Location can also be used to set the power-up in Run Mode option.
Default: 0060 Lower Byte Range: Range: 10 – Counter 20 – Quadrature 30 – Pulse Out 40 – Interrupt 50 – Pulse Catch 60 – Filtered discrete In. Upper Byte Range: Bits 8–12, 14, 15: Unused Bit 13: Power–up in RUN, if Mode Switch is in TERM position.
Setup Registers for High-Speed I/O functions
Default: 1006
Pulse/Direction Reserved
Default: 0000 N/A Default: 0000 Range: 0003–03E7h (3–9999ms) N/A Default: 00E0 Default: 8501
Timed Interrupt
V7650–V7654 V7655 V7656
N/A
Reserved Port 2: Setup for the protocol, time-out, and the response delay time. Port 2: Setup for the station number, baud rate, STOP bit, and parity.
DL05 Micro PLC User Manual, 6th Edition, Rev. A
Page 98
Chapter 3: CPU Specifications and Operation System V-memory V7657 V7660 V7661 V7662–V7717 V7720–V7722 V7720 V7721 V7722 V7723–V7750 V7751 V7752–V7754 V7755 V7756 V7757 V7760–V7762 V7763 V7764 V7765 V7766 V7767 V7770 V7771 V7772 V7773 V7774 V7775 V7776 V7777
Description of Contents
Default Values/Ranges
Port 2: Setup completion code used to notify the completion of the parameter setup
Default: 0A00
Scan control setup: Keeps the scan control mode Setup timer over counter: Counts the times the actual scan time exceeds the user setup time Reserved
Default: 0000
Locations for DV–1000 operator interface parameters Titled Timer preset value pointer Title Counter preset value pointer HiByte-Titled Timer preset block size, LoByte-Titled Counter preset block size Reserved Fault Message Error Code, stores the 4-digit code used with the FAULT instruction when the instruction is executed Reserved Error code, stores the fatal error code Error code, stores the major error code Error code, stores the minor error code Reserved Program address where syntax error exists Syntax error code Scan, stores the total number of scan cycles that have occurred since the last Program Mode to Run Mode transition Contains the number of seconds on optional Memory Cartridge clock (00-59) Contains the number of minutes on optional Memory Cartridge clock (00-59) Contains the number of hours on optional Memory Cartridge clock (00-23) Contains the day of week on optional Memory Cartridge (Mon., Tues., Wed., etc.) Contains the numerical day of month on optional Memory Cartridge (01, 02, etc.) Contains the numerical month on optional Memory Cartridge (01 to 12) Contains the year on optional Memory Cartridge (00 to 99) Scan, stores the current scan time (milliseconds) Scan, stores the minimum scan time that has occurred since the last Program Mode to Run Mode transition (milliseconds) Scan, stores the maximum scan time that has occurred since the last Program Mode to Run Mode transition (milliseconds)
DL05 Micro PLC User Manual, 6th Edition, Rev. A
N/A
1 2 3 4 5 6 7 8 9 10 11 12 13 14 A B C D
3–27