各大品牌PLC存储器寻址规则详解—Detailed explanation of the addressing rules of PLC memory of major brands  

在PLC编程时,字节或多字节的变量一般支持绝对地址寻址(比如,IW0、MD4等)。要想正确寻址,则必须要搞清楚寻址的规则。目前常见的规则有两种:字节寻址和字寻址。
When programming a PLC, byte or multi-byte variables generally support absolute address addressing (e.g., IW0, MD4, etc.). In order to address correctly, it is necessary to understand the rules of addressing. There are two common rules today: byte addressing and word addressing.

下图清晰地表达了两种规则的编号情况: The following diagram clearly illustrates the numbering of the two rules:

各大品牌PLC存储器寻址规则详解---Detailed explanation of the addressing rules of PLC memory of major brands  

注:n是字节编号。 Note: n is the byte number.

上图中,字节、字、双字都是长度单位,并不是变量类型,比如:一个实数变量的长度是4字节,要占用2个字或者1个双字的连续存储空间。一个整型变量的长度是2字节,要占用1个字的连续存储空间。
For example, the length of a real variable is 4 bytes, which occupies 2 words or 1 double word of continuous storage space. The length of an integer variable is 2 bytes, which occupies 1 word of continuous storage space.

在字节寻址的情况下,以第一个字节编号为变量的地址编号,例如,MB1,MW1,MD1起始地址相同,长度不同。
In the case of byte addressing, the address number with the first byte number as the variable, for example, MB1, MW1, MD1 start from the same address but are different in length.

字节寻址的优点:便于寻址,后缀数字即是首地址。 Advantages of byte addressing: easy to address, the suffix number is the first address.

字节寻址的缺点:同一编号类型(比如W、或者D,下同)内存地址间存在重叠的可能,使用时需要自行空出相应区域。比如两个实数长度为4个字节,如果没有注意变量的长度,分别分配了MD0(占用MB0-MB3)、MD2(占用MB2-MB5)的地址,则他们存在两个字节的重叠(MB2、MB3),当我们修改一个变量时,另外一个变量就会跟着变化。如果分配了MD0、MD4的地址,则不存在问题。
Disadvantage of byte addressing: There is a possibility of overlap between memory addresses of the same numbering type (such as W, or D, the same below), and you need to vacate the corresponding area when using it. For example, if the length of two real numbers is 4 bytes, if you don’t pay attention to the length of the variable, and assign the addresses of MD0 (occupying MB0-MB3) and MD2 (occupying
MB2-MB5) respectively, then they have two bytes of overlap (MB2, MB3), and when we modify one variable, the other variable will change accordingly. If an address of MD0 or MD4 is assigned, there is no problem.

在字寻址的情况下,字节、字、双字等分别编号,例如ID1的首地址与W2、IB4相同。存在倍数换算。
In the case of word addressing, bytes, words, and double words are numbered separately, for example, the first address of ID1 is the same as that of W2 and IB4. There is a multiplier conversion.

字寻址的优点:同一编号类型内存地址互相独立,互不影响,可以放心使用。上面两个实数的例子里,在这儿就不存在问题,因为,MD0占用MB0-MB3、MD2占用MB4-MB7。
Advantages of word addressing: The memory addresses of the same number type are independent of each other and do not affect each other, so they can be used with confidence. In the above two examples of real numbers, there is no problem here, because MD0 occupies MB0-MB3 and MD2 occupies MB4-MB7.

字寻址的缺点:使用的时候,不同编号类型内存地址需要进行换算。如果同时用到MW、MD,就要考虑他们之间是否可能重叠了。
Disadvantages of word addressing: When used, memory addresses of different numbering types need to be converted. If MW and MD are used at the same time, it is necessary to consider whether they may overlap with each other.

CODESYS系的PLC、日系PLC、施耐德、MODBUS、通讯等是字寻址。而西门子是典型的字节寻址。
CODESYS PLC, Japanese PLC, Schneider, MODBUS, Communication, etc. are word addressing. Whereas Siemens is typical byte addressing.

来源:https://blog.csdn.net/chengjl8/article/details/134042912
Source: https://blog.csdn.net/chengjl8/article/details/134042912

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
电气技术

"电机工作象限:你知道吗?这可能影响设备性能哦!""Motor Working Quadrant: Did You Know? This may affect the performance of your device. "  

2024-1-17 22:59:45

电气技术

电机降压启动的原因及为什么要降压启动

2024-2-18 11:26:54

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索