IF1 port of the X20CP1382 cannot open

Hello,

I’m Levy, Automation Engineer and B&R CP learner.

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.

I got an error “8252” despite all the effort.

Attached are the images of my Ladder blocks.

Expecting your feedback, thanks in advance.

Hi,

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).

Best regards!

Thanks for the response.

I have made the change as recommanded, but still getting the same error :

“IF1” = pDevice

“/PHY=RS232 /PA=E /DB=8 /SB=1 /BD=57600” = pMode

On the B&R Modbus sample ST program, the pConfig is linked to a (‘datamod’) which comes with the sample project.

But in my project tree, there is no data object (‘datamod’) that should be linked to the pConfig.

Do I have to create it ? if yes how to go about ?

I also sent you an image of the IF1 port config to see if this is where the port/protocol should be activated.

Please I need your support.

Expecting your response thanks.

Regards !

Hi,

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:

Best regards!