I need your help, for I want to run Modbus RTU via the IF1 of the X20CP1382 CP using Ladder, but the MBMOpen block does not open the IF1 port during testing.
do you try to open the CPU integrated serial interface (located on the X1 terminal block)?
If yes, I think the interface address “SL1.IF1” is wrong, the integrated interface address is just “IF1”.
“SL1” would address an X20IFxxxx module plugged into the PLCs slot for additional interfaces.
You can check the interface address in the physical view of the project - in hardware tree view there’s a column with the addresses (maybe you have to activate this column first, I’m not sure right now as I’m not in front of a workstation).
yes you need to create a data module containing the definitions about the modbus data to read / write.
Here’s an older discussion about the functionality… it’s not exactly the configuration you use, but contains some helpful information about how it works in general… the whole background is programming language independent, so you should find more hints there:
But I’m wondering that you said the error is still the same: the error number 8252 clearly sais that the serial interface that should be opened does not exist:
The missing data module should throw a different error number as far as I know.
So please double check the interface definition.
I see in the screenshots that your strings seems to be defined with " … as far as I know, these are 2byte string definitions (wide strings = datatype WSTRING). But the function blocks need ascii strings which are defined by ’ (dataytpe STRING).
So please check if your strings are declared as WSTRING (which won’t work) and if yes redefine them as STRING (for example ‘IF2’) according the function block interface description of MBMOpen: