Hi Jon,
In this case you will need to download the Modbus/TCP library from the PLCnext Store. The documentation for this library will help. You will be using the MB_TCP_Client function block, since the EMPRO comms module is a Modbus/TCP server.
Once you install this library on your PC and import it as a User Library into PLCnext Engineer, you can just drag and drop the MB_TCP_Client FB on to your ST code sheet to create an instance of the FB.
The documentation describes each of the FB parameters.
After establishing a connection with MB_TCP_Client FB instance, you will then need to read registers using one of the MB_TCP_FC.. function blocks, probably MB_TCP_FC3 to start with.
But before you try to get the PLC communicating with the EMPRO, I suggest that you follow the Modbus guide in the EMPRO User Manual to test the Modbus comms. In particular:
- Download the "Modbus Poll" software that is recommended in section 10.1.5 of the EMPRO User Manual. Use this software to check that you can read the data you need from the EMPRO using the Modbus/TCP protocol. Follow the description in the "Modbus RTU" section of the EMPRO User Manual, but instead of choosing "Serial Port" in the "Connection" box, choose "Modbus TCP/IP" and enter the IP address of the EMPRO comms module. Other than that, all the Modbus register addresses etc. should be exactly the same for Modbus RTU and Modbus TCP (Modbus TCP is just the "Ethernet" version of the serial RTU protocol).
- Chapter 11 of the EMPRO User Manual contains the list of Registers that are available via Modbus. I guess you will be choosing a sub-set of these registers for your application.
Once you are reading data from EMPRO registers correctly using the "Modbus Poll" software tool, you can then switch to PLCnext Engineer and set up the MB_TCP_Client and MB_TCP_FC3 Function Blocks to read the same registers from the EMPRO.
If you are considering switching to Matlab Simulink in future, then I suggest building your ST code to read the Modbus registers, and then write them to OUT ports in your ST program. Your Simulink program can then define IN ports to receive the EMPRO data, and it will just be a matter of linking the OUT and IN port variables together in PLCnext Engineer. Until you have Simulink, you can write a second IEC program (a "Simulink Simulator", if you like) to do the calculations that Simulink will eventually do. Again, you can pass data from your ST program (data collector) to the Simulink Simulator, via OUT and IN ports. This will make the switch to Simulink, seamless.
Good luck!
Martin.
Phoenix Contact Electronics Headquarters - PLCnext Runtime Product Management and Support