Hi,
I have two words that I need to combine into a 32-bit one
word1 must be the Most Significant one
and word2 must be the Last Significant one
how could I achieve this point?
Thank you
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have two words that I need to combine into a 32-bit one
word1 must be the Most Significant one
and word2 must be the Last Significant one
how could I achieve this point?
Thank you
Check CAA Memory library.
https://help.codesys.com/webapp/s6roH8o ... n=3.5.12.0 m
Hi mikeardy!
The direct way in structured text would be
DWord := SHL(WORD_TO_DWORD(word1), 16) OR WORD_TO_DWORD(word2);
which makes a binary OR between the two variables after shifting the word1 to the most significant position.
Good luck!
Alfred
If you need it to be stored, the declaring a union datatype may help.