ed@gsdware
I'm trying to decide between using OpenPLC or the straight Arduino IDE to solve some engineering problems. Both roads have some bumps in them.
 
In my case, I'm able to connect to a C-more HMI using Arduino code via a Modbus RTU connection. Code like this:
 
#include <ArduinoRS485.h>  // ArduinoModbus depends on the ArduinoRS485 library
#include <ArduinoModbus.h>
 
ModbusRTUServerClass port1_server(Port1); // Create modbus client on port 1
 
if (!port1_server.begin(10, 9600, SERIAL_8E1)) {
    Serial.println("Failed to start Modbus RTU Server!");
    while (1);
  }
 
I'm trying to do something similar in OpenPLC, and I can't get things to work. I'm not sure which interface to select (Serial, Serial1, etc). I've tried several and can't seem to get things to go.
2025-03-24 16_03_38-Transfer Program to PLC.png
 
Here's my C-MORE settings that work fine with the Arduino IDE code:
2025-03-24 16_07_40-Panel Manager.png
 
On the plus side, I was able to get Modbus TCP working (verified via Radzio Master Simulator), which I haven't yet accomplished with my Arduino code.
 
I could use Modbus TCP to talk to the HMI, but then debugging gets very hard. Plus, that would limit the usefulness of the finished project. If I use Modbus RTU to connect to the HMI, I can connect some read-only factory automation system via Modbus TCP.
 
I'd appreciate any suggestions anyone has. Not sure if the P1AM-SERIAL module is even supported by OpenPLC.
Reply 0 0
ed@gsdware
>OpenPLC can only talk (as a slave) in TCP protocols
Reply 0 0
thiagoralves
P1AM-SERIAL is not supported on OpenPLC. The Modbus RTU on P1AM will work only through the P1AM USB port - i.e. if you connect the P1AM to your computer, you will be able to get data from Radzio using Modbus RTU through the new serial port that appears once you connect the P1AM USB cable.
 
However, I don't see why using Modbus/TCP on P1AM would be a problem. If you want to inspect data going through the wire, there are a multitude of software that can do that, with much more features and ease of use when compared to debugging a serial wire. Wireshark is one of these softwares, that works very well on Windows, Linux and macOS, and allows you to see the exact frames that are being sent and received over the TCP network. Not to mention that Modbus/TCP is much faster than Modbus/RTU 🙂
 
Also, if you're concerned about having other devices connected to the PLC over Modbus simultaneously, you can do that just fine with Modbus/TCP. I might need to recheck the code for that to be sure of the exact number, but I believe OpenPLC supports up to 5 simultaneous connections over Modbus/TCP. So you can connect the HMI and other read-only factory devices to the P1AM, all using Modbus/TCP.
Reply 0 0
ed@gsdware
One of the reasons I've been hesitant to use Modbus/TCP is that the P1AM requires the programmer to enter the MAC address of the P1AM-ETH module. For Arduino IDE, I was entering this in the code (which I didn't like). Using the serial port, I didn't need to think about how to store a resource ID in the codebase.
 
On OpenPLC, the MAC address is in the Transfer dialog, which makes more sense to my developer brain.
 
Thanks for the fast response - I'll give a shot at flipping my C-more over to Modbus/TCP and running it into a network switch instead of directly into the P1AM-ETH. I've used Wireshark before. Ladder logic, tho... That I still have to figure out. 🙂
Reply 0 0
thiagoralves
If ladder seems too complicated, try Structured Text. It will feel more familiar for people with background on imperative procedural oriented language like C
Reply 0 0
Reply