使用搜索功能查看 Kepware 的信息库,其中包含 500 多篇知识库文章。缩小搜索结果范围,或在下面的搜索字段中输入您的查询。

或者,如果您无法找到解决方案,我们还有另一个资源:我们的 PTC eSupport Portal。 如果系统提示您登录 eSupport Portal,您可以使用“我的 Kepware”凭据。需要一个“我的 Kepware”帐户吗?在此处创建

搜索解决方案结果:
View All Solutions

Kepware Knowledge Base: Solution


Siemens S5 Byte Swapping in Strings


Last Update: 2018/11/7

In KEPServerEX V5.15, the Siemens S5 driver was enhanced to support byte swapping for the String data type. Strings can be from 2 to 254 characters (bytes) in length. All strings are assumed to be in a HiLo byte order, meaning that for each register (which is 2 bytes in length) there can be 2 characters. An issue can occur if an odd string length is used or if an odd number of characters is written to the string and the incorrect byte order is used.

For example, assume that there is a tag with the address "DB1:KS0.5H" and with a value of "AFTER" written to it. If users read it from a tag with an address of "DB1:KS0.5L" they would see a value of "FAET". This is because the tag is consuming DB1 Register 0, 1, and 2. The actual value stored in the three registers is 0x414651455200. The last byte of the string is the string terminator, which is a Null (0x00). When the byte order is swapped, the registers are essentially viewed as having a value of 0x464145540052. When updating the tag value, the driver stops at the null value. This will also occur anytime a non-printable character is included in the string. PLC programmers should avoid including control characters (0x01 to 0x1F) or any extended characters (0xA0 to 0xFF) in registers that will be read as part of a string.

Related Products
Siemens S5

Related Protocols
Siemens S5 3964(R)