Hello,
First, please excuse my question I am new to Modbus.
I have a CX-5140 control unit from Beckhoff and an instrumentation device that measures (Temperature, Humidity, etc.).
The device can function as a Modbus slave and hence I am using EL6021 EtherCAT terminal & TwinCAT Modbus RTU library to receive data from the device. The device has 36 registers of data all are 16-bit. In the data sheet of the device, each two registers represents a measured parameter ( for example: register 1 and register 2 are temperature....register 3 and register 4 are humidity ....and so on).
I was able to read the data from the device successfully in an array like so:
arrReceivedData : Array [1..40] of WORD;
Now my question is:
How can I combine any two registers such as arrReceivedData[2] and arrReceivedData[3] into another REAL variable??
In C++ world, I could easily use functions and macros such as HIWORD(something) & LOWORD(something) to re-write a 32-bit data type like "int" by using two 16-bit data type like "short" ....but there is no such function blocks in PLC or CX world to do so.
Thank you all.
First, please excuse my question I am new to Modbus.
I have a CX-5140 control unit from Beckhoff and an instrumentation device that measures (Temperature, Humidity, etc.).
The device can function as a Modbus slave and hence I am using EL6021 EtherCAT terminal & TwinCAT Modbus RTU library to receive data from the device. The device has 36 registers of data all are 16-bit. In the data sheet of the device, each two registers represents a measured parameter ( for example: register 1 and register 2 are temperature....register 3 and register 4 are humidity ....and so on).
I was able to read the data from the device successfully in an array like so:
arrReceivedData : Array [1..40] of WORD;
Now my question is:
How can I combine any two registers such as arrReceivedData[2] and arrReceivedData[3] into another REAL variable??
In C++ world, I could easily use functions and macros such as HIWORD(something) & LOWORD(something) to re-write a 32-bit data type like "int" by using two 16-bit data type like "short" ....but there is no such function blocks in PLC or CX world to do so.
Thank you all.