Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
I have an array of Bytes reading different messages from a COB-ID, one of them is a 16 bit signed INT, 2's compliment and other one is 16 bit unsigned INT, 2's compliment. What would be the best way to read them. Any function block for conversion? I assume I will have to take 2's compliment of the data read?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have an array of Bytes reading different messages from a COB-ID, one of them is a 16 bit signed INT, 2's compliment and other one is 16 bit unsigned INT, 2's compliment. What would be the best way to read them. Any function block for conversion? I assume I will have to take 2's compliment of the data read?
Thanks
Possible solution is to define a DUT Type Union with Array of 2 bytes and an int:
Then declare a variable of this type in your application, write the 2 bytes into the array and use the int
Related
Talk.ru: 1