cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

ModBus RTU on CORE

AndroidzZ
New Contributor

ModBus RTU on CORE

Is modbus RTU possible on the ctrlX CORE?
I have found that the S20-RS-UNI supports ModBus RTU but are there any libraries for this?

17 REPLIES 17
CodeShepherd
Community Moderator

Re: ModBus RTU on CORE

There is a library called CXA_MODBUSRTU. Please have a try with this one.

CodeShepherd_0-1632912979746.png

 

TheCodeCaptain
Community Moderator

Re: ModBus RTU on CORE

Hi,

please find attached some example project.

It reads the actual power production from a Fronius Symo Solar Inverter.

Keep in mind you have to configure in the datalayer tree each single element, like I did in the screenshot, to get it working.

Done with version 1.14

TheCodeCaptain_0-1650895684988.png

 

AndroidzZ
New Contributor

Re: ModBus RTU on CORE

I see that there are many FBs in CXA_ModbusRTU behind the heading CXA_S20. These are all FBs based on the S20.

I assume that I can't use these FBs when working with a Modbus RTU module from beckhoff (EL6751), can I?

If not, is this Modbus RTU library also usable for third party RTU modules? 

 

TheCodeCaptain
Community Moderator

Re: ModBus RTU on CORE

Hi AndroidzZ,

we didn't test it with a Beckhoff module as we have our own.

Most likely this will not work. You can check if beckhoff provides examples for Codesys V3.

Or just take our module. 🙂

 

AndroidzZ
New Contributor

Re: ModBus RTU on CORE

I would like nothing more than to use Bosch but I need a short term solution. And Beckhoff were the only cards I could get my hands on..

Thanks for the tip I will look for examples.

Novice
New Poster

Re: ModBus RTU on CORE

As a colleague of AndroidZz, I am currently testing the set-up with a CtrlX and RS485 card from Beckhoff (EL6021).
The EL6021 is connected to the CtrlX over EtherCat.
Wiring is OK, test with Beckhoff-PLC works well.
Basis for testing on CtrlX is "ModbusRTUtest.zip" as posted by TheCodeCaptain a few posts above.
- CXA_ModbusRTU.CXA_S20.IH_S20ComConfiguration works flawlessly. "bInOperation_ComConfig" immediately becomes TRUE.
- when calling "IH_S20MBRTUMaster" I get an error ACCESS_ERROR with ErrorIdent of CXA_TABLE-16#0C0F0000-16#0C850031.
Some questions:
- where can I find information regarding 16#0C850031
- how do I determine the slot number of the RS485 card?
In the example uiSlot is := 3... my RS485 card is as 3rd module after the EtherCat slave station...?
Kind regards,

CodeShepherd
Community Moderator

Re: ModBus RTU on CORE

Like mentioned in posts above and as the name suggest this library is usable for an S20 IO module. Please ask the supplier of your module for a library or example code usable for it.

Error codes and explanations can always be found in our online documentation. In your case see this page.

Novice
New Poster

Re: ModBus RTU on CORE

I try to import the Beckhoff library into CtrlX PLC Engineering, but I get error message "Failed to open managed library. (Reason: Missing string table entry for ID=7428)". See attached.
How can I solve this?

 

CodeShepherd
Community Moderator

Re: ModBus RTU on CORE

Could you please send me this library so we can have a look to it.

It seems that this is a Twincat2 library. We cannot be sure that these are able to be used in the ctrlX PLC. We tested a library "Tc2_ModbusRTU.compiled-library-ge33" tht is part of the standard installation of Twincat and it could be inserted in our ctrlX PLC library manager. Please check if you can find and use this one.

Novice
New Poster

Re: ModBus RTU on CORE

Hi CodeShepherd,

I tried to export the library in Twincat in 2 ways:
- via export function of the "Library Repositry"
- look up the relevant file in "Explorer" --> see screenshot "Lib-file Twincat.png".
  I assume you tested at your side with that same file. Am I correct?

When importing I keep getting the same message "Missing string table..."

Attached 2 pieces library in "Twincat-libs.zip":
- "Tc2_ModbusRTU.compiled-library" taken from export function
- "Tc2_ModbusRTU.compiled-library-ge33" copied from folder 3.4.2.0 of TwinCat

Kind regards,

CodeShepherd
Community Moderator

Re: ModBus RTU on CORE

We tested with the second library you mentioned. But I would have to check the version we used. As there is main vacation time in Germany, answers could need some time.

AndroidzZ
New Contributor

Re: ModBus RTU on CORE

I am a colleague of Novice. I have updated ctrlX WORKS and the PLC app on the CORE both to version 1.16 but still get the same error as Novice, see attachment.

I do notice that:
"Tc2_ModbusRTU.compiled-library" is a COMPILED-LIBRARY file format and
"Tc2_ModbusRTU.compiled-library-ge33" is a COMPILED-LIBRARY -GE33 file format.

GE33 is also not directly recognized by the library repository. Must first set the explorer to 'All files (*.*)' when selecting files. see attachment 2

Therefore the question if the library repository is the right way to import the library?

 

CodeShepherd
Community Moderator

Re: ModBus RTU on CORE

Sorry for the delay. We are using version 3.4.3.0 and it can be imported without any error in ctrlX PLC Engineering version 1.12 and 1.16 via the library repository.

Library repository Tc2_ModbusRTULibrary repository Tc2_ModbusRTU

AndroidzZ
New Contributor

Re: ModBus RTU on CORE

Thanks for the info. I got that library installed now.

AndroidzZ_0-1662555847829.png

 

cc2go
Long-established Member

Re: ModBus RTU on CORE

Hello @AndroidzZ ,
does it work with the installed Beckhoff library, the Modbus RTU communication, now?

AndroidzZ
New Contributor

Re: ModBus RTU on CORE

i haven't had time to really figure it out yet

AndroidzZ
New Contributor

Re: ModBus RTU on CORE

Maybe worth mentioning that we are using a temporary solution (RTU --> TCP gateway). I will put time in the library, but just not at the moment.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist