Modbus Integration Kit with Groov EPIC LC

So I have my Groov EPIC LC set as the Control Engine. I found that when I run the chart Modbus_Master for any of the functions to pull data from an emulated slave modbus device Modbus Slave Simulator that is running on a configured 127.0.0.25 IP and defautl port but if I run a Control Engine that is an EPIC Sim running on IP 127.0.0.1 everything works. Anyone know what I need to configure on the EPIC?

You have to set the port to be 8502. Not the default of 502.
Look on the EPIC firewall and you will see that port 8502 is open.
There is a tech note about it if you take a dig.
Will check in the morning for it.

Ok here is the KB I was referring to.

https://www.opto22.com/support/resources-tools/knowledgebase/kb87577

Here is a forum post I did on the EPIC / RIO firewall.
It may help you understand why not below 1024 and other tips.

So whats I am running into right now is I can run the PAC Sim on IP 127.0.0.1 port 8502 and then run a simulated ModbusDevice over TCP/IP using modbustools.com with a mbslave on ip 127.0.0.25 port 8502 and everything works. If I then change the control engine to my EPIC LC on ip 192.168.0.28 port 8502 the O22Modbus03ReadHoldingRegistersAsInt has a n03AsIntStatus of = 2 which if the documentation is right means ‘illegal data address’ this in modbus i thought refers to the number of return values to read. The number of registers read is equal to nIntegerType=0 - 1 =nNumReturnValues or ntegerType=4 =2*nNumReturnValues and for me this value has not changed just the IP address to for the controler

A few comments that I hope are helpful.

Let me start by saying what I said in this post over here;
The good thing about having a standard like Modbus is that everyone can implement it however they like.

Marys post here is still very valid;

You might be using this tech note already, if not, take a review.
https://www.opto22.com/support/resources-tools/documents/2011-using-modbus-devices-with-opto-22-products

I think the main thing you will find helpful is the PAC Manager Modbus Calculator;

It is also built into groov Manage.

Its under I/O - I/O Tools.

Bottom line, I am pretty sure the PAC Sim Modbus registers are different from EPIC that’s why you are getting the error. (You will need to change more than just the IP address).

Thanks @Beno I am learning a lot and still wrapping my head around some things. Can you help me understand what the Modbus Calculator, its use, purpose and what it configures? Can you help me understand what MMP stands for.

What exactly are you doing here? I think you mean you have a comm handle configured to open to 127.0.0.1:8502, yes? So the PAC Sim is reading data from the simulator and everything is running on the localhost, so all is good.

Okay, so this is listening on the local computer on port 8502 - The 127.x.x.x IP range is only localhost, which PAC Sim would be able to “see” since it also is running on the local computer. The EPIC PR1 will not be able to communicate to any simulator running on localhost on your computer.

Again, not sure what you are doing here. Are you are running the same strategy that you were running on PAC SIM on the EPIC PR1? What do you have the comm handle in your strategy set to? If it is still 127.0.0.25:8502, then you are talking to the PR1 itself (You could be using 127.0.0.1:8502 as it is the same thing). Since the PR1 has a modbus server, you got a response, and it told you the address you requested is invalid.

Since you are getting a 2-Invalid address response, you are requesting a register that doesn’t exist on the PR1, as you have discovered. Use the Modbus calculator that @Beno posted about to look up the “Register Address” and add 1 to it to get the Modbus register. You will also need to change the slave address parameter to the Unit ID # that was given in the calculator.

Note for Opto22: The calculator should be captioned either “Address” or “Register” and not both, as these mean subtly different things in Modbus. The Modbus Address is the Modbus Register minus 1. I know every other manufacturer does the same thing… sigh.

1 Like

MMP is Memory Mapped Protocol.
Just about every point, feature or parameter on an Opto controller has a memory map address.
The MMP is how you address it from a third party, something like Python, C++ or .Net for example.

If you are using a PAC Controller or EB, then PAC Manager is your friend.

Here is a typical example, all those Values have an MMP address.

If you are using a groov family product (EPIC or RIO), then groov Manage has you covered.

You can see we have included all the MMP address for all the different areas in those devices.

Hi Philip so to clarify. I am using using (http://modbustools.com) application to create a modbus slave device with a Unit ID = 30 with several registers see:


In PAC Control I am using the Modbus Integration Kit and have the handle as: SetCommunicationHandleValue("tcp:127.0.0.26:8502", chModbus);//Comm handle for Modbus/TCP slave
and the params as:

nt03AsIntParametersBurner[0] = 2;//Protocol - 0 = Serial RTU, 1 = Serial ASCII, 2 = Modbus/TCP
nt03AsIntParametersBurner[1] = 30;//Slave Address - serial 0-247 - Modbus/TCP 0-255
nt03AsIntParametersBurner[2] = 1000;//Timeout in ms
nt03AsIntParametersBurner[3] = 0;//Word Order - 0 = Lower register least significant, 1 = Lower register most significant
nt03AsIntParametersBurner[4] = 0;//Dword Order - Reserved - set to 0

and then i am calling

O22Modbus03ReadHoldingRegistersAsInt

when I updated the UnitID to 30 i dont get the 2 error in 03AsIntStatus but now get a 0 but no data is returned.

The EPIC PR1 cannot see the simulator on your PC since the simulator is running on the localhost (all 127.x.x.x addresses are loop back addresses - no data ever hits the wire, so it never leaves the local network stack).

When running the strategy on the EPIC PR1, you are still requesting the localhost, which now refers to the EPIC PR1 itself, which will obviously have different registers than your simulator.

If you want the EPIC PR1 to access your simulator, then you need to setup your simulator to use (bind) your computers network interface address - whatever that may be. You will also need to open the firewall on your computer to allow access on the modbus port you are using - I would recommend using port 502 for the simulator, by using 8502, which is the non-standard port that the EPIC’s modbus server uses, you are confusing yourself.

So set the simulator to bind to your computers address on port 502. Open TCP 502 on your computer in the firewall. Change the strategy to connect to your computers IP address on port 502.

Ok I will look into that. Thanks Philip.