Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 65 of 70

SLC 500 Instruction Set Reference Manual, pages 641 to 650

Pages 641 to 650 of 694

The original document is the PDF (7.2 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 1747-L514

Page 641

Data File Organization and Addressing

E-19

When entering values into an instruction or data table element, you can specify the radix of your entry using the appropriate suffix. The radixes that can be used to enter data into an instruction or data table element are: • integer (D). • binary (B). • hexadecimal (H). • octal (O). Numeric constants are used in place of data file elements. They cannot be manipulated by the user program. You must enter the offline program editor to change the value of a constant.

M0 and M1 Data Files Specialty I/O Modules

M0 and M1 files are data files that reside in specialty I/O modules only. There is no image for these files in the processor memory. The application of these files depends on the function of the particular specialty I/O module. For some modules, the M0 file is regarded as a module output file and the M1 file is regarded as a module input file. In any case, both M0 and M1 files are considered read/write files by the SLC 5/02 and higher processors. M0 and M1 files can be addressed in your ladder program and they can also be acted upon by the specialty I/O module-independent of the processor scan. It is important that you keep the following in mind in creating and applying your ladder logic.

TIP

During the processor scan, M0 and M1 data can be changed by the processor according to ladder diagram instructions addressing the M0 and M1 files. During the same scan, the specialty I/O module can change M0 and M1 data, independent of the rung logic applied during the scan.

Publication 1747-RM001G-EN-P - November 2008

Page 642

E-20

Data File Organization and Addressing

Addressing M0-M1 Files The addressing format for M0 and M1 files is below: Mf:e.s/b Where M = module f = file type (0 or 1) e = slot (1 to 30) s = word (0 to max. supplied by module) b = bit (0 to 15)

Restrictions on Using M0 and M1 Data File Addresses M0 and M1 data file addresses can be used in all instructions except the OSR instruction and the instruction parameters noted below.

Table E.7 Instruction parameters not available for Use with M0 and M1 data File Addresses Instruction

Parameter (uses file indicator #)

BSL, BSR

File (bit array)

SQO, SQC, SQL

File (sequencer file)

LFL, LFU

LIFO (stack)

FFL, FFU

FIFO (stack)

Monitoring Bit Addresses SLC 5/02 and Higher Processors with M0 and M1 Monitoring Disabled When you monitor a ladder program in the run or test mode, the following bit instructions, addressed to an M0 or M1 file, are indicated as false regardless of their actual true/false logical state.

Publication 1747-RM001G-EN-P - November 2008

Page 643

Data File Organization and Addressing

Mf:e.s b

Mf:e.s b

Mf:e.s b

Mf:e.s

Mf:e.s

L

U b b

E-21 f = file (0 or 1) When you are monitoring the ladder program in the run or test mode, the programming terminal does not show these instructions as being true when the processor evaluates them as true.

SLC 5/03 and Higher Processors The SLC 5/03 and higher processors allow you to monitor the actual state of each addressed M0/M1 address (or data table). The highlighting appears normal when compared to the other processor data file. The SLC 5/03’s performance is degraded to the degree of M0/M1 referenced screen data. For example, if your screen has only one M0/M1 element, degradation is minimal. If your screen has 69 M0/M1 elements, degradation is significant. If you need to show the state of the M0 or M1 addressed bit, you can transfer the state to an internal processor bit. This is illustrated in the following figure, where an internal processor bit is used to indicate the true/false state of a rung.

This rung will not show its true rungstate because the EQU instruction is always shown as true and the M0 instruction is always shown as false.

OTE instruction B3/2 has been added to the rung. This instruction shows the true or false state of the rung.

Transferring Data Between Processor Files and M0 or M1 Files As pointed out earlier, the processor does not contain an image of the M0 or M1 file. As a result, you must edit and monitor M0 and M1 file data via instructions in your ladder program. For example, you can copy a block of data from a processor data file to an M0 or M1 data file or vice versa using the COP instruction in your ladder program. The COP instructions below copy data from a processor bit file and integer file to an M0 file. Suppose the data is configuration information affecting the operation of the specialty I/O module. Publication 1747-RM001G-EN-P - November 2008

Page 644

E-22

Data File Organization and Addressing

First scan bit. It makes this rung true only for the first scan after entering the Run mode.

The COP instruction that follows copies data form an M1 data file to an integer file. This technique is used to monitor the contents of an M0 or M1 data file indirectly, in a processor data file.

Access Time During the program scan, the processor must access the specialty I/O card to read/write M0 or M1 data. This access time must be added to the execution time of each instruction referencing M0 or M1 data.

Minimizing the Scan Time You can keep the processor scan time to a minimum by economizing on the use of instructions addressing the M0 or M1 files. For example, XIC instruction M0:2.1/1 is used in rungs 1 and 2 of the figure below, adding approximately 2 ms to the scan time if you are using an SLC 5/02, Series B processor.

XIC instructions in rungs 1 and 2 are addressed to the M0 data file. Each of these instructions adds approximately 1 ms to the scan time (SLC 5/02, Series B processor).

Publication 1747-RM001G-EN-P - November 2008

Page 645

Data File Organization and Addressing

E-23

In the equivalent rungs of the following figure, XIC instruction M0:2.1/1 is used only in rung 1, reducing the scan time by approximately 1 ms.

These rungs provide equivalent operation to those of figure A by substituting XIC instruction B3/10 for XIC instruction M0:2.1/1 in rung 2. Scan time is reduced by approximately 1 ms (SLC 5/02, Series B processor).

The following figure illustrates another economizing technique. The COP instruction addresses an M1 file, adding approximately 4.29 ms to the scan time if you are using an SLC 5/02, Series B processor. Scan time economy is realized by making this rung true only periodically, as determined by clock bit S:4/8. (Clock bits are discussed in appendix in this manual.) A rung such as this might be used when you want to monitor the contents of the M1 file, but monitoring need not be on a continuous basis.

S:4/7 causes the #M1:4.3 file to update the #N10:0 file every 2.56 seconds.

Publication 1747-RM001G-EN-P - November 2008

Page 646

E-24

Data File Organization and Addressing

Capturing M0-M1 File Data The first two ladder diagrams in the last section illustrate a technique allowing you to capture and use M0 or M1 data as it exists at a particular time. In the first figure, bit M0:2.1/1 could change state between rungs 1 and 2. This could interfere with the logic applied in rung 2. The second figure avoids the problem. If rung 1 is true, bit B3/10 captures this information and places it in rung 2. In the second example of the last section, a COP instruction is used to monitor the contents of an M1 file. When the instruction goes true, the 6 words of data in file #M1:4.3 is captured as it exists at that time and placed in file #N10.0.

Specialty I/O Modules with Retentive Memory Certain specialty I/O modules retain the status of M0-M1 data after power is removed. See your specialty I/O module user’s manual. This means that an OTE instruction having an M0 or M1 address remains on if it is on when power is removed. A “hold-in” rung as shown below will not function as it would if the OTE instruction were non-retentive on power loss. If the rung is true at the time power is removed, the OTE instruction latches instead of dropping out; when power is again applied, the rung is evaluated as true instead of false.

ATTENTION

When used with a specialty I/O module having retentive outputs, this rung can cause unexpected start-up on powerup.

You can achieve non-retentive operation by unlatching the retentive output with the first pass bit at powerup.

Publication 1747-RM001G-EN-P - November 2008

Page 647

Data File Organization and Addressing

E-25

This rung is true for the first scan after powerup to unlatch M0:2.1/1.

G Data Files - Specialty I/O Modules

Some specialty I/O modules use G (confiGuration) files (indicated in the specific specialty I/O module user’s manual). These files can be thought of as the software equivalent of DIP switches. The content of G files is accessed and edited offline under the I/O Configuration function. You cannot access G files under the Monitor File function. Data you enter into the G file is passed on to the specialty I/O module when you download the processor file and enter the REM Run or any one of the REM Test modes.

Editing G File Data Data in the G file must be edited according to your application and the requirements of the specialty I/O module. You edit the data offline under the I/O configuration function only. With the decimal and hex/bcd formats, you edit data at the word level. • G1:1 = 234 (decimal format) G1:1 = 00EA (hex/bcd format)

TIP

Word 0 of the G file is configured automatically by the processor according to the particular specialty I/O module. Word 0 cannot be edited.

Publication 1747-RM001G-EN-P - November 2008

Page 648

E-26

Data File Organization and Addressing

Notes:

Publication 1747-RM001G-EN-P - November 2008

Page 649

Appendix

F

Number Systems

This appendix: • covers binary and hexadecimal numbers. • explains the use of a hex mask to filter data in certain programming instructions.

Binary Numbers

The processor memory stores 16-bit binary numbers. As indicated in the following figure, each position in the number has a decimal value, beginning at the right with 20 and ending at the left with 215. Each position can be 0 or 1 in the processor memory. A 0 indicates a value of 0; a 1 indicates the decimal value of the position. The equivalent decimal value of the binary number is the sum of the position values.

Positive Decimal Values The far left position will always be 0 for positive values. As indicated in the figure, this limits the maximum positive decimal value to 32767. All positions are 1 except the far left position. Other examples:

0000 1001 0000 1110

= 211+28+23+22+21 = 2048+256+8+4+2 = 2318

0010 0011 0010 1000

= 213+29+28+25+23 = 8192+512+256+32+8 = 9000

1

Publication 1747-RM001G-EN-P - November 2008

Page 650

F-2

Number Systems

0111

1111

1111

1111

1x214 = 16384 1x213 = 8192 1x212 = 4096 1x211 = 2048 1x210 = 1024 1x29 = 512 1x28 = 256 1x27 = 128 1x26 = 64 1x25 = 32 1x24 = 16 1x23 = 8 1x22 = 4 1x21 = 2 1x20 = 1 32767

0x215 = 0 This position is always zero for positive numbers.

Negative Decimal Values The 2s complement notation is used. The far left position is always 1 for negative values. The equivalent decimal value of the binary number is obtained by subtracting the value of the far left position, 32768, from the sum of the values of the other positions. In the following figure, the value is 32767 32768 = -1. All positions are 1. Another example: 1111 1000 0010 0011 = (214+213+212+211+25+21+20) - 215 = (16384+8192+4096+2048+32+2+1) - 32768 = 30755 - 32768 = -2013. An often easier way to calculate a value is to locate the last 1 in the string of 1s beginning at the left, and subtract its value from the total value of positions to the right of that position. For example, 1111 1111 0001 1010 = (24+23+21) - 28 = (16+8+2) - 256 = -230.

Publication 1747-RM001G-EN-P - November 2008