Reading 168-bit String Data from Generator via Modbus on WAGO 750-8208

Hi everyone,

I’m working with a WAGO 750-8208 PLC, and I’m programming using CODESYS 2.3. I’m trying to read data from a generator that communicates over Modbus RTU through the PLC’s COM port.

The generator provides various types of data:

  • 32-bit and 16-bit data are being read successfully.
  • However, there are some values, especially fault/event messages, that are sent in 168-bit, 136-bit and 144-bit lengths.

According to the generator’s data sheet, these values span 20 Modbus registers (each 16-bit). The data is actually a string message, sent across these 20 registers, and only appears when a certain fault occurs.

My questions:

  1. How can I properly read and combine these 20 Modbus registers as a string in CODESYS 2.3?
  2. Is there any function block or formula that can help convert these register values into a readable string?
  3. Has anyone faced a similar situation with Modbus string data parsing on WAGO PLCs?

I’d appreciate any example code or guidance on how to implement this logic in CODESYS 2.3. Thanks in advance!

If you copy the contents of your 20 registers into an array of 20 WORDS, then you can create a STRING variable that is declared at the same memory address.

Some trial and error might be needed, because the math doesn’t quite work out as I would expect - 20 Modbus registers is 40 bytes, which would mean 40 ASCII characters. If your generator only packs one ASCII character into each register, you’ll want to do some byte manipulation to properly pack a 20 BYTE array (instead of a 20 WORD array) so that the STRING will work properly.