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