PLC polling GIGI R1 over WIFI with ModbusTCP

Very new to both arduino and c++. I have been searching both the web and forums and not really seeing my sitution, my world has been PLC w/ ladder and function block so trying to learn c++/structured text is new but im trying.

Sitution is i have a several strings of temperature sensors to read, 12 per string, multiple strings per location, several locations per site. The idea is put a GIGI R1 per string and use a router to set DHCP per GGI R1 then lock the tables. that way i dont have to program static ip's in the GIGI and i can write 1 program for all GIGI's that are on any site. all i need to do is grab the analog input and i am guessing put it in a modbus real address, i am going to leave it as raw data and not scale it. then the PLC would just poll each GIGI, this would only need to happen once a minute or two, not non stop.

I am unclear if i need to include any sort of modbus.h file, if so, which one, which leads to putting each analog point into a real, so does a modbus create the data registers and i just need to do like move analogread(1) to (30000) - this was just an example of what i envision. I have not orderered my GIGI yet, but i did order a smaller one with WIFI as a way to start testing when i get the code figured out, i want to keep the GIGI code as simple as possible with the idea that i could write 1 program for all of them and not have to keep a program for every single instance. its possible i could have 30 to 40 per site.

this is what i have so far:

// 2024.02.28 - Rev1-Analog pin, WIFI & ethernet

]
#include <WiFi.h>

#include <WiFiClient.h>

#include <WiFiSSLClient.h>

#include <WiFiServer.h>

#include <WiFiUdp.h>

#include <Ethernet.h>

#include <ArduinoModbus.h>

void setup() {

analogRead(0);

analogRead(1);

analogRead(2);

analogRead(3); // put your setup code here, to run once:

analogRead(4);

analogRead(5);

analogRead(6);

analogRead(7);

analogRead(8);

analogRead(9);

analogRead(10);

analogRead(11);

}

void loop() {

// put your main code here, to run repeatedly:

int HoldigRegCnfg;

HoldigRegCnfg = modbusserver.configureHoldingRegisters(1,200);//Holding Registers 40001 to 40201

}
\

Thanks in advance with helping me through this learning process.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.