Please I would like your help for DWORD Values concatenation which is not displaying the Vibration Sensor Value on Codesys.
This Vibration Sensor is connected to CodeSys 3.5 via a VSE151 module (Please see attached a Single Line from Screenshot 1)
The VSE151 displays correct values, but the concern is on Codesys which is displaying Vibration values in Bytes. Others Screenshots are attached showing the mismatch.
I would like to get the real values in Codesys. Any help would be really appreciated.
I created the variables in GVL as you told me, but I still don't get the values in Real (Screenshot 1), the values are always shown in bytes as in Screenshot 2.
Could you please explain more how to solve this Offset probem ? why can't I see the real values of the vibration object defined in VSE151?
Thanks so much.
Map your incoming bytes to AsBytes[0], [1], [2] and [3] and the REAL value should appear in AsReal.
You may need to change the order 0123 to 2301 in the mapping depending on the device.
Hi All,
Please I would like your help for DWORD Values concatenation which is not displaying the Vibration Sensor Value on Codesys.
This Vibration Sensor is connected to CodeSys 3.5 via a VSE151 module (Please see attached a Single Line from Screenshot 1)
The VSE151 displays correct values, but the concern is on Codesys which is displaying Vibration values in Bytes. Others Screenshots are attached showing the mismatch.
I would like to get the real values in Codesys. Any help would be really appreciated.
Make a GVL that has
VAR
VRmsTimeDomain : REAL AT %IB0;
VRmsTimeDomainState : BYTE AT %IB4;
END_VAR
You can get the correct %IB from the Offset (Relative) column of Screenshot 2.
Hi,
I created the variables in GVL as you told me, but I still don't get the values in Real (Screenshot 1), the values are always shown in bytes as in Screenshot 2.
Could you please explain more how to solve this Offset probem ? why can't I see the real values of the vibration object defined in VSE151?
Thanks so much.
Hello
Try creating a UNION between:
AsBytes: ARRAY[0..3] OF BYTE;
AsReal: REAL;
Map your incoming bytes to AsBytes[0], [1], [2] and [3] and the REAL value should appear in AsReal.
You may need to change the order 0123 to 2301 in the mapping depending on the device.
Related
Talk.ru: 1
Talk.ru: 2
Talk.ru: 3
This forum is loaded on this topic:
https://forge.codesys.com/forge/talk/CODESYS-V2/thread/e75cc2ca73/?limit=250#3940
Last edit: aliazzz 2020-06-19
Hi aliazz,
Thanks a lot for your help, I found the solution in the link you sent me, the 'Union sructure' in codesys.
TYPE uRealBytes :
UNION
rValue : REAL; // Needs 4 Bytes in memory
abValue: ARRAY [0..3] OF BYTE;
END_UNION
END_TYPE
Special thanks to all of you guys for your help and concern, I really appreciate.