
put your main code here, to run repeatedly: Serial.println( "ID del maestro (arduino): " + String(ID)) 16reg = au16data // pointer to a memory array in the Arduino Telegram.u16CoilsNo = 2 // number of elements (coils or registers) to read Telegram.u16RegAdd = 2 // start address in slave

Telegram.u8fct = 3 // function code (this one is registers read) tTimeOut( 5000 ) // if there is no answer in 5000 ms, roll over Unsigned long int irradiancia //32 bits sin signo Unsigned int respuesta //sin signo porque es como se recibe Uint8_t u8query //!< pointer to message query This is an structe which contains a query to an slave device Modbus(u8id, u8serno, u8txenpin, u8rxenpin) U8rxenpin pin for rxen RS-485 (=0 means USB/RS232C mode) NO EN ESTA LIBRERIA U8txenpin pin for txen RS-485 (=0 means USB/RS232C mode) U8id : node id = 0 for master, = 1.247 for slave I put my code here (it is quite similar to the example code): #include What's the problem with the millis()? and how should i modify the library to solve the problem? I've read this old Forum about the same subject, but it is closed and i don't fully understand the solution given there.
#Modbus poll setup how to
So, the error must be in the receiving part.Īs I said, i can read the data from the pyranometer using serial.read(), but this solution is not valid to as i need in a further step to connect more than one pyranometer to the rs485, and i don't know how to manage the responses or controling the data without a library.
#Modbus poll setup serial
I know i am receiving things because i made a proof conecting the rx to a diferent serial port, and I read the response using Serial.read(). I am able to transmits data, and the pyranometer responds as it should, but the function modbus.poll() doesn't receive anything.

I am using Modbusrtu.h library, but it doesn't seem to work correctly.

I want to read some data from a pyranometer using Modbus, an arduino mega and a max485 converter (to create a rs485 grid, the complete proyect includes several pyranometer connected to the same port of the arduino).
