pascal Posted June 11, 2021 Report Share Posted June 11, 2021 I have following question : I'm using modbus communication to read some values of a powermeter. Instead of reading 40 variables - one by one - I read them in one modbus cyle, into a buffer... with the command buffer to struct, I can copy the values from the buffer to the struct. But when defining the structure, can I be 100% sure that the position of my variables in the structure is like I programmed the structure ? I give an example : I read 12 bytes via modbus ( 3 floating values) into buffer read[0..11] I have a struct with variables float1 - float 2 - float 3 then I use buffer to struct.... are the first 4 bytes going to float1, second 4 bytes to float 2 and last 4 bytes to float3 ? I tested this, yes they do......but is this always like this? I need to know if when recompiling the program, or copying this UDFB to another PLC program, will be always working with the "correct postioned" structure... Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.