Penny know PLC indirect addressing and direct addressing
by:Coolmay
2020-08-13
Direct addressing points out that the exact operation instruction address directly.
For example A Q10.
0, for instructions A Q10.
0 is the direct manipulation of address.
therefore, relative, indirect addressing the indirect points out instructions the exact address.
For example, A Q [
MD10]
, the address is not directly given here, but indirectly through MD10 this memory address.
the types of indirect addressing indirect addressing can be divided into two types: memory indirect addressing and register indirect addressing.
As shown in figure 1.
Figure 1 memory addressing way indirect addressing memory indirect addressing the address of a given format is: + pointer address identifier.
Pointer indicates the value contained in the storage unit, by numerical unit is the exact address.
memory indirect addressing format is divided into two kinds of Pointers: 16 pointer: 16 address pointer for the timer, counter, block (
DB、FC、神奇动物)
Addressing, 16 pointer is regarded as an unsigned integer (
0 -
65535).
It said the timer (
T)
And counter (
C)
And data blocks (
DB、DI)
Or block (
FB, FC)
Number of 16 bit pointer format is as follows: figure 2 16 pointer format 32-bit pointer: 32-bit address pointer is used to I, Q, M, L, a block of data bits, bytes, characters, such as storage and double word addressing, 32-bit address pointer can use a double word, said a 0 ~ 2 a as an address of addressing operation, 3rd to 18th as addressable byte address operation, 19th ~ 31 is not defined, 32-bit pointer format is as follows: figure 3 32-bit pointer format register indirect addressing register indirect addressing to pass the CPU address register AR1, AR2 addressing.
AR1, AR2 are 32-bit registers, register indirect addressing only use 32-bit pointer.
is divided into internal addressing regional indirect addressing and cross area.
Internal area register indirect addressing pointer format same as a pointer to a 32-bit memory indirect addressing, a 0 ~ 2 a as an address of addressing operation, 3rd to 18th as addressable byte address operation, 19th ~ 31 is not defined, 32-bit pointer format is as follows: figure 4 internal regional 32-bit pointer cross regional register indirect addressing contains a pointer to the memory area information, called cross region pointer.
Similarly, cross area by 32-bit pointer, register indirect addressing to use address register AR1 or AR2.
32-bit pointer, cross area left 0 ~ 18 format is the same as the inner regions of the 32-bit Pointers, 19 ~ 23, 27 ~ 20 undefined, 31 for cross region pointer identifier.
24 ~ 26 is a storage area address identifier, 8 said 8 kinds of storage area: 000 indicates no address area, such as P# 12.
0;
001 said I input the address area, such as P# I12.
0;
Q 010 said output address area, such as P# Q12.
0;
M. 011, says mark address area, such as P# M12.
0;
100 said data blocks (
DB)
The data, such as P# DB1.
DBX12.
0101 said data blocks (
DI)
The data, such as P# DI1.
DIX12.
0110 L said area address area, such as P# L12.
0;
111 said call V block area address area, such as P# V12.
0;
Cross region POINTER format is as follows: P# POINTER and ANY POINTER P# POINTER to POINTER is a kind of used to pass a POINTER parameter according to the type, the length is 6 bytes.
Used to be called the function of the FC and function block of FB transfer compound data types (
Such as ARRAY, STRUCT and DT, etc. )
The argument.
In the called function FC and FB internal function blocks to indirect access to the argument of the memory.
figure 6 P# POINTER ANY POINTER POINTER is a kind of used to pass a POINTER parameter according to the type, can be seen as an extension of POINTER type, a POINTER type to complex, length of 10 bytes, add 2 bytes, maximum byte (
字节0)
The second byte (fixed for B# 16 # 10,
字节1)
As ANY the data type of the pointer points to area, and the next two bytes (
字节3、4)
Combination for an INT, the length of the area for ANY Pointers, known as the coefficient of repeated Repetition factor)
。
The remaining six byte function the same as the POINTER type.
Format is as follows: figure 7 ANY pointer