产品展示
联系我们
联系人:陈柳铭
手机:15579209656
电话:
Q Q:3136378118
邮箱:3136378118@qq.com
地址:江西省九江市瑞昌市东益路23号赛湖农商城401号
3615E
在许多应用中,需要向从设备读取或写入浮点数据。示例程序仅为ReadData和Write Data数组提供一个INT数组(16位有符号整数值)。为了向从设备读/写浮点数据,必须添加额外的梯形图,以处理数据到ControlLogix处理器内真实数据类型的转换。这很容易做到。以下主题介绍如何向从属设备读取或写入数据。这些主题还显示了何时在模块配置中使用浮点标志和浮点启动参数。对于所有应用程序,可以从设备读取浮点数据,而无需更改浮点标志和浮点启动参数。您只需配置这些参数,即可向使用单个Modbus地址(如47001)来表示单个浮点值的设备发出写入命令。这是从设备的寻址,参数“能耗”显示为两个寄存器40257和40258。值描述类型40257------KWH能耗浮点,低16位40258 KWH能耗浮点,高16位要对此参数发出读取命令,请使用以下配置。参数值说明启用1每次通过命令列表发送命令。IntAddress 1000将数据放置在模块内存的地址1000处。根据ModDef中的配置,这将把数据放在标记MCM上。数据。READDATA[0]。轮询0此命令没有延迟。计数2从从设备读取2个连续寄存器。这2个Modbus寄存器将构成“能耗”浮点值。交换0交换代码描述0无-字节顺序(1234=1234)1个字-交换字(1234=3412)2个字和字节-交换字,然后交换每个字中的字节(1234=4321)3个字节-交换每个字中的字节(1234=2143)节点1将命令发送到节点#1。Func 3发出Modbus功能代码3“读取保持寄存器”DevAddress 256与功能代码3一起,DevAddress 256将读取从设备的Modbus地址40257。除功能代码3外,DevAddress 256还将读取从设备的Modbus地址40257。上述命令将读取Modbus从站#1的40257和40258,并将该数据放入MCM中。数据。READDATA[0]和[1]。在ControlLogix处理器的controller tags(控制器标签)部分中,有必要配置数据类型为“REAL”的标签,如下图所示。[+]能耗实际[1]浮动
In many applications, it is necessary to read or write floating-point data to the Slave device. The sample program only provides an INT array for the ReadData and Write Data array (16-bit signed integer value). In order to read/write floatingpoint data to and from the Slave device, you must add additional ladder to handle the conversion of the data to a REAL data type within the ControlLogix processor. This is very easy to accomplish. The following topics show how to read or write data to a Slave device. These topics also show when to use the Float Flag and Float Start parameters within the module configuration. For all applications, floating-point data can be read from a device without any changes to the Float Flag and Float Start parameters. You only need to configure these parameters to issue a Write command to a device that uses a single Modbus address, such as 47001, to represent a single floating-point value.Here is the addressing of a Slave device, with a parameter "Energy Consumption" that is shown as two registers 40257 and 40258. Value Description Type 40257 -------- KWH Energy Consumption Float, lower 16 bits 40258 KWH Energy Consumption Float, upper 16 bits To issue a Read command to this parameter, use the following configuration. Parameter Value Description Enable 1 Sends the command every time through the command list. IntAddress 1000 Places data at address 1000 of the module memory. Based on the configuration in ModDef this will put the data at the tag MCM.DATA.READDATA[0]. PollInt 0 No delay for this command. Count 2 Reads 2 consecutive registers from the Slave device. These 2 Modbus registers will make up the "Energy Consumption" floatingpoint value. Swap 0 Swap Code Description 0 None - No Change is made in the byte ordering (1234 = 1234) 1 Words - The words are swapped (1234=3412) 2 Words & Bytes - The words are swapped then the bytes in each word are swapped (1234=4321) 3 Bytes - The bytes in each word are swapped (1234=2143) Node 1 Sends the command to Node #1. Func 3 Issues a Modbus Function Code 3 to "Read Holding registers." DevAddress 256 Along with the Function Code 3, DevAddress 256 will read Modbus address 40257 of the Slave device. Along with the Function Code 3, DevAddress 256 will read Modbus address 40257 of the Slave device. The above command will read 40257 and 40258 of the Modbus Slave #1 and place that data in MCM.DATA.READDATA[0] and [1]. Within the controller tags section of the ControlLogix processor, it is necessary to configure a tag with the data type of "REAL" as shown in the following illustration. [+] Energy_Consumption REAL[1] Float
相关产品