I need to send Data including 6 integers and several individual bits from my B&R PLC over profinet via X20IF103-1 slice. The configuration of the device allows me to define 64 BYTES outputs or single Integer. Since I need to send more do I just use the address of the High byte of the value and leave the lower byte(s) undefined and it automatically sends the data accordingly??
Example of X20IF103-1 I/O Mapping:
Channel Name: Module002_Input006
Process Variable: iSomeInteger (USINT)
and the integer value will be passed over
Module002_Input006 (High byte of the integer)
Module002_Input005 (Low Byte of the Integer)
and So on?
Thanks for your help
Here is an example of how you can communicate data via Profinet. Please note that for data types with more than one byte, the bytes must be swapped.
I copy all input and output data into USINT arrays
In the cyclic task I then copy the input and output data into their target variables
Thanks Stephan, especially for introducing brsmemcpy(). I can do it your way, but I want to know if I can do it following way. Notice, I am sending out Real Value defined as Real, this is to make it convenient for the receiver of the data.
Of course, you can also transfer float variables directly. The master configuration must then have exactly the same structure as the slave configuration. Please remember the byte order, you have to swap the bytes of the float variable from little-endian to big-endian either on the master or on the slave side.