nodemcu with modbus protocol

I am having modbus device . i would like to read data from modbus device through nodemcu and display data.

I have made connection as shown image attached. I have made connection as shown in example
http://en.trialcommand.com/blog/esp8266-master-modbus-rtu-rs232/instead of using usb to rs232 i used usb to ttl out,

with modbus connected with usb to ttl. if i send request from modscan32 i used to get response from modbus device.

i would like to know few thing from above example

  1. How to view nodemcu modbus register using modscansoftware, if i select nodemcu comport it gives out time out error.
  2. HOW can i read data from my slave device using this library.
  3. I tried other library function its not working as soon as connect TX and rx line with other library it stop working

my application is simple node mcu must send request like modscan32 from usbto ttl .read reply and display output.

i have attached serial out for reference. weather RS232 circuit is needed???
Nodemcu test code.

#include <ModbusMaster232.h> 
#include <SoftwareSerial.h>  // Modbus RTU pins   D7(13),D8(15)   RX,TX

// Instantiate ModbusMaster object as slave ID 1
  ModbusMaster232 node(1);

void setup()
{

  Serial.begin(9600);
  delay(100);  
  node.begin(9600);  // Modbus RTU
  delay(100);
  Serial.println("Connected "); 
  Serial.println("Modbus RTU Master Online");
  
}


void loop()
{
//Website http://trialcommand.com
///////// Holding Register [0]  A [9]   = 10 Holding Registers Escritura
///////// Holding Register [0] A [9] = 10 Holding Registers Writing

int Mdelay = 5; 

node.readHoldingRegisters(0, 1); 
Serial.print("[0] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
  
node.readHoldingRegisters(1, 1); 
Serial.print(" [1] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
    
node.readHoldingRegisters(2, 1); 
Serial.print(" [2] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);

node.readHoldingRegisters(3, 1); 
Serial.print(" [3] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
node.readHoldingRegisters(4, 1); 
Serial.print(" [4] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
node.readHoldingRegisters(5, 1); 
Serial.print(" [5] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
node.readHoldingRegisters(6, 1); 
Serial.print(" [6] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
node.readHoldingRegisters(7, 1); 
Serial.print(" [7] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
node.readHoldingRegisters(8, 1); 
Serial.print(" [8] ");
Serial.print(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
node.readHoldingRegisters(9, 1); 
Serial.print(" [9] ");
Serial.println(node.getResponseBuffer(0));
node.clearResponseBuffer();
delay(Mdelay);
 
    
///////// Holding Register [10]  A [19]  =  10 Holding  Registers Lectura
/////     Holding Register [10] A [19]   =  10 Holding Registers Reading  

  node.writeSingleRegister(10, random(1, 10 )); 
  node.writeSingleRegister(11, random(1, 10 )); 
  node.writeSingleRegister(12, random(1, 10 )); 
  node.writeSingleRegister(13, random(1, 10 )); 
  node.writeSingleRegister(14, random(1, 10 )); 
  node.writeSingleRegister(15, random(1, 10 )); 
  node.writeSingleRegister(16, random(1, 10 )); 
  node.writeSingleRegister(17, random(1, 1000 )); 
  node.writeSingleRegister(18, random(1, 10 )); 
  node.writeSingleRegister(19, random(1, 1000 )); 
  
}

I could not able to replicate the example to test it out. It work till serial print not work with modscan32 software

I am having modbus device

Do you really have non-standard ModBus device that communicates over TTL level serial? The standard for ModBus RTU is RS-485.

If you really have a device with TTL output, your wiring is wrong. You have to connect RX of the device to TX on the ESP and vice-versa. In between the two you must have a level converter as TTL level is 5V and the ESP runs on 3V3. If you connected it that way you already might have fried your NodeMCU.

What kind of device are we talking about? Link to the manual?
Are you sure that device has slave address 1 configured?

Hello
In the modbus rtu master program, if I want to read the address 4113 and its function is 4, what should I do in the address software. I’ve sent the address of the address below. Please help.

This is a program for the Windows platform. An Arduino forum isn't the right place to ask questions not related to the Arduino.