Hi to all,
I am trying to establish communication between Arduino and PLC with Modbus TCP/IP Client/Server. I don't have any errors in program, just I have problem to ping Arduino IP address. I am using Arduino Uno R3 and Ethernet shield W5100, also IP address of my Ethernet port (on PC) is 192.168.200.5.
I will leav in attachments my program, maybe somebody could me advise what is wrong? I have been follow this video: Siemens S7-1200 PLC to Arduino - YouTube
My program:
#include "EtherCard.h"
#include "Modbus.h"
#include "ModbusIP_ENC28J60.h"
const int SENSOR_IREG = 100;
const int sensorPin=A0;
ModbusIP mb;
long ts;
void setup() {
Serial.begin(9600);
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 200, 6};
mb.config(mac,ip);
mb.addIreg(SENSOR_IREG);
ts=millis();
}
void loop() {
mb.task();
if(millis()>ts+2000){
ts=millis();
mb.Ireg(SENSOR_IREG, analogRead(sensorPin));
Serial.println(analogRead(sensorPin));
}
}