Accessing the raw Process Data of a Serial Module in a PFC200 Node with CODESYS 3.5

Recently I was asked if it’s possible to access the raw process data of a serial module (e.g., 750-652) using CODESYS 3.5, similar to how it could be done with CODESYS 2.3. The user had written their own function blocks a few years ago in CODESYS 2.3 to control various serial devices through the process data, and they wanted to reuse that code rather than rewrite the function blocks using an I_Port (i.e., Interface object), as is typically done with CODESYS 3.5 and WAGO’s application function blocks.

In this case, the key is to use the I_Port methods to access the raw process data as byte arrays. These arrays can then be used in the PLC program as if they were mapped directly in the I/O configurator—similar to how CODESYS 2.3 maps the data.
The .SetProcessOutData() and .GetProcessInData() methods are then called during each PLC scan to refresh the arrays.

Example:

2 Likes

If I may, i would like to add:
Call .GetProcessInData() and .GetProcessOutData() before the program which use the IO and call .SetProcessOutData() after the program.

.GetProcessInData();
.GetProcessOutData();

... customer code here ...

.SetProcessOutData();

By doing this you will have the latest IN/OUT data before your code and update the OUT after your code.

1 Like