ArduinoModbus Library using MAX845 module

Only for answer my question for others, you can place your numerical data in the register in this way: uint16_t au16data[16] = { <#data1>, <#data2>, <#data3>, <#data4>, <#data5>, <#data6>, <#data7>, 8, 0, 0, 0, 0, 0, 0, 1, -1 };, but if you try to adjust the code example from this library, this Arduino schema does not work (timeout error):

// This code is not working
#include <DHT.h>
#include <ModbusRtu.h>

// data array for modbus network sharing (inputRegister)
uint16_t au16data[2];

DHT dht(11, DHT22);

/**
 *  Modbus object declaration
 *  u8id : node id = 0 for master, = 1..247 for slave
 *  port : serial port
 *  u8txenpin : 0 for RS-232 and USB-FTDI 
 *               or any pin number > 1 for RS-485
 */
Modbus slave(3,Serial,2); // this is slave @1 and RS-232 or USB-FTDI

void setup() {
  dht.begin();
  Serial.begin(9600);
  slave.start();  

}

void loop() {
   
   delay(2000);   // Wait a few seconds between measurements.
   
   float h = dht.readHumidity();
   float t = dht.readTemperature();   // Read temperature as Celsius
 
   if (isnan(h) || isnan(t)) {
     au16data[0] = 0;
     au16data[1] = 0;
     return;
   } 
   au16data[0] = (float)t;
   au16data[1] = (float)h;
     
   slave.poll(au16data, 2);
}

So I decided to use another library from simplemodbusng by Angelo Compagnucci. And with this same wiring diagram, I used the next code and now is fully working:

#include <SimpleModbusSlave.h>
#include <DHT.h>

#define DHTPIN 11     // Connected to Pin D11
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE);

//////////////// registers of your slave ///////////////////
enum  {
  // just add or remove registers and your good to go...
  // The first register starts at address 0
  TEMP,
  HUM,
  TOTAL_ERRORS,
  // leave this one
  TOTAL_REGS_SIZE 
  // total number of registers for function 3 and 16 share the same register array
};

unsigned int holdingRegs[TOTAL_REGS_SIZE]; // function 3 and 16 register array
////////////////////////////////////////////////////////////

#define RX            0     // Arduino defined pin (PB0, package pin #5)
#define TX            1     // Arduino defined pin (PB1, package pin #6)
#define RS485_EN      2     // pin to set transmission mode on RS485 chip (PB2, package pin #7)
#define BAUD_RATE     9600  // baud rate for serial communication
#define deviceID      3     // this device address


void setup() {

  // dht begin
  dht.begin();  

  /* parameters(long baudrate, 
                unsigned char ID, 
                unsigned char transmit enable pin, 
                unsigned int holding registers size,
                unsigned char low latency)
                
     The transmit enable pin is used in half duplex communication to activate a MAX485 or similar
     to deactivate this mode use any value < 2 because 0 & 1 is reserved for Rx & Tx.
     Low latency delays makes the implementation non-standard
     but practically it works with all major modbus master implementations.
  */
  
  modbus_configure(BAUD_RATE, deviceID, RS485_EN, TOTAL_REGS_SIZE, 0);

}

void loop() {

  delay(2000);   // Wait a few seconds between measurements.
  float h = dht.readHumidity();
  float t = dht.readTemperature();   // Read temperature as Celsius
  
  if (isnan(h) || isnan(t)) {
    holdingRegs[0] = 0;
    holdingRegs[1] = 0;
    return;
  }

  holdingRegs[0] = (float)t;
  holdingRegs[1] = (float)h;
  modbus_update(holdingRegs);
}

For test this schema I used a Windows tool named "Radzio! Modbus MAster Simulation" with this configuration: