MODBUS RTU in function block

Hi, I’m using the modbus-rtu 7 library from the plc next store. But I encounter the following: If I put everything in the main program I can send and receive data from the FC3. When I spilt up the connection and the fc3 in functionbloks It doesn’t work anymore. It result in the following error: wDiagcode: C020, wAddDiagCode: 60 which is data send error in module. The axl F RS UNI 1H is configured as RS485 modbus rtu. Kind regards, David de Roo

Hello David, my guess is that you now are using 2 local variables. This way the FC3 will no longer communicate with the Connect FB.

→ Make sure that the In / Out Data Exchange variables share the same variable.

kind regards,
Oliver

Hi Oliver, Thanks for your answer, but I’m using the same variable. Even if I connect the straight away it doesn’t work. I can send you the program if you want to. David de Roo

Hello David, yes please send me this part of the project. Oliver

Hi Oliver, I uploaded the source this morning in https://phoenixcontact.sharefile.eu/r-r4e642c7badd441a8 . David

Hey,

sorry for the delay. This looks like you are missing the write operation for the InOut Variable in your ST part of the funktionblock.
To avoid mistakes like this and easy debuging you can MIX FUB and ST inside your custom funktionblock

This part looks fine. (in/out Exchange) Sorry i was thinking of the old PC Worx where you had to write InOutVariables explcitly.

I have to look into it further seems to be application specific.

Hi Oliver, I know it looks fine, But it doesn’t work for some reason. If I put everything in het main - folder then it works flawlessly. But not in the functionbloks. David