How to pack sil communication variables to other controller ,and how to unpack tat communication variables .
Don't "pack" variables. There is very little advantage in the communications overhead (because the number of bytes and messages to be transmitted is the same) but it makes variables VERY difficult to trace between controllers.
If you use MMS then read wth MMS_Read_Cyc(5). Allways try to read, don't write, so that you can trace the code more easily. Give the MMS vars and variables in both controllers the same name, again so that you can trace the code properly. MMS will automatically place all 5 variables in the same message.
If you use IAC set the same source / destination and cycles times and the controller will automatically place all 5 variables in the same message.
I have done same in following way,on Modbus TCP:
Use Standard Inbuilt Fucntion Blocks, which accepts as 8 or 16 or 32 Boolean Inputs, and gives the packed Output as WORD.( i dont remember exactly remember names of Blocks, I think it was BCtoDword or DintotBC) ,please re-check about blocks
You can give address that Output word according to your need.
Similarly proceed for Float values.
Further just use your ACCESS VARIABLES, and read or write accordingly