reading a 32bit value from a modbus slave device using com_mod_mast
I want to read a float value from a mod bus slave device using com_mod_mast.
Is any type casting required to read the value properly in plc, if so then how to do it.
i have defined an array of datatype word of length 2 in the data input of the com_mod_mast block.But Im getting some unknown value of 16828 in the first word of the array while the second word reads zero for a value of 23.5 in the slave device.
Voted best answer
No type cast required. Just change your array to real type variable. If the value is still incorrect then you probably have reversed bytes or words
Answers
Hello,
You can refer Codesys help file for information on COM_MOD_MAST block.
You can refer Codesys help file for information on COM_MOD_MAST block.
https://forum.codesys.com/viewtopic.p...
The value you are reading is an IEEE floating point number. You can verify it here ... https://www.h-schmidt.net/FloatConver...
Add new comment