
phoenixsmartphonerepair (Customer) asked a question.
getting P001:PLC COM time out error
My setup was working fine EA3-S3ML with P1AM with ethernet module.I now keep getting a P001:PLC COM time out error. I currently have both the P1AM and HMI connected to a switch I have also tried connecting them directly. I am using the IP 192.168.0.177 on both the HMI and The PLC. Still no joy. Is there anyone that can help me with this.
Can you share your code?
Sure
#include <Ethernet.h>
#include <P1AM.h>
#include <ArduinoRS485.h> // ArduinoModbus depends on the ArduinoRS485 library
#include <ArduinoModbus.h>
byte mac[] = { //Use the �Reserved MAC� printed on the right-side label of your P1AM-ETH.
0x60, 0x52, 0xD0, 0x07, 0x42, 0xC7
};
IPAddress ip(192, 168, 0, 177); //IP Address of the P1AM-ETH module.
EthernetServer server(502);
ModbusTCPServer modbusTCPServer;
bool cmore_button = false; // state of cmore button
int cycleCount;
void setup() {
Serial.begin(115200);
Serial.println("Modbus TCP Server and Module I/O Example");
while (!P1.init()) {} ; //Wait for P1 Modules to Sign on
Ethernet.begin(mac, ip);
server.begin();
if (!modbusTCPServer.begin()) {
Serial.println("Failed to start Modbus TCP Server!");
while (1);
}
modbusTCPServer.configureCoils(0x00, 16); //setup 16 coils starting at address 0
}
void loop() {
static unsigned long counter;
EthernetClient client = server.available(); //listen for incoming clients
if (client) {
if (client.available()) {
Serial.println("Got Client");
modbusTCPServer.accept(client); //accept connection
modbusTCPServer.poll();// service any Modbus TCP requests, while client connected
cmore_button = modbusTCPServer.coilRead(1); // Read coil 1, coilRead adds the function code
if(cmore_button == TRUE){
P1.writeDiscrete(cmore_button, 2,2);
}
for(int i = 0; i <= 1; ++i){
counter++;
}
if (client && !client.connected()) {
client.stop();
}
}
}
}
Could you post a picture of the c-more panel manager page with the network setup?
And what address on the c-more is the coil button assigned to? The Arduino library starts at 0 while the c-more starts at 1, so they may look mismatched despite working.
the cmore_button was written to address 0.
I have tried (1) also and no joy
I also tried resetting to factory and then updating the firmware again. I changed the IP to 192.168.0.177 and 192.168.1.177 for both the arduino and hmi. Still no connection
What is your subnet mask set to? 255.255.0.0? Try setting panel to 192.168.0.178 to see if it clears the issue.
just tried that it does not work
should the subnet mask be set to 255.255.0.0?