Hello, another question from a Codesys newbie, is a possible way to convert an integer value to a byte array,for example i try to make a program that the user will insert a value such 567 and i want to convert it to 4 bytes
Thank you in advance
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, another question from a Codesys newbie, is a possible way to convert an integer value to a byte array,for example i try to make a program that the user will insert a value such 567 and i want to convert it to 4 bytes
Thank you in advance
An INT is only 2 Bytes Long. There are several ways to achieve this.
One is to create a union with an INT and an array of BYTES
If you create a variable:
Then you can copy the integer into
Then the two bytes that make up that integer will be available at:
Related
Talk.ru: 1
Thank you very much for your reply, if I write this code I receive an error about UNION, is it a codesys code?
Actually in older Codesys you Need to activate the Proffesinal Feature to find Union.