How to decode the data sent by Balluff camera to PLC over the TCP/IP interface?

Data structure sent by Balluff camera to PLC over the TCP/IP interface

Result container 

If an inspection program uses a "Send results" tool, the inspection program will send the result data in this message after processing the inspection program.

 

image-png-Sep-30-2020-04-12-43-60-PM

 

Example of how a result container is formed:

After each completed inspection BVS Cockpit sends a results container to the controlling system. The structure of the user data depends on the configuration in BVS Cockpit. In this example it is assumed that an inspection was configured which provides a string of 20 bytes (= 14hex). BVS Cockpit reads the text “Hello World” and sends it to the controlling system.

The coding of the text is in ASCII format. The text that is read (11 bytes long) is shorter therefore than the area provided in the message (20 bytes). BVS Cockpit therefore fills the remaining bytes with zeros. One-byte chain is simply sent after the other. Little-endian has no meaning here since these are individual bytes.

 

The entire message is thus:

20hex 00hex (Message ID)
16hex 00hex (user data length = 2 bytes for inspection program ID + 20 bytes result data)
15hex 00hex (inspection program ID: 21)
48 65 6C 6C 6F 20 57 6F 72 6C
64 00 00 00 00 00 00 00 00 00
(ASCII: 'H', 'e', 'l', 'l' 'o', space, 'W', 'o', 'r', ‚l ‘, 'd', 9× fill-bytes)

 

Learn more about BVS