I am working a new project where the ESP32 is a modbus master device and must read data from max 40 slave devices.
Every slave device has the same 64 registers table.
I must build a descriptor variable (variable type mb_parameter_descriptor_t) with 64x40 entry ?
And if I change a slave device with a different type I have to rewrite my descriptor table and rebuild all my code ?
I can't do this dinamically using only a reference descriptor for different types of slaves devices in my network and associate it to slave address in "field" when installing the network.
mdobus RTU serial port multiple slaves
-
- Posts: 211
- Joined: Fri Feb 01, 2019 4:02 pm
- Contact:
Re: mdobus RTU serial port multiple slaves
Hello @accacca,
The descriptor must contain information about all registers in all slaves that you are going to access using the Modbus read/write API.
So, the description table is a map of your network segment. However, you do not need to rewrite this table each time manually. You can fill it dynamically using data from SD card or fill it according to data from JSON file. This descriptor should be created before the start of Modbus stack. If your network map is changed you can stop stack then update the table then start communication again.
If this does not work for your application for some reason you can use the ModbusMaster wrapper CPP class to access the registers or even use the mbc_master_send_request() API in your esp-idf application (do not require the descriptor table in this case).
https://github.com/alisitsyn/modbus_sup ... aster/main
The descriptor must contain information about all registers in all slaves that you are going to access using the Modbus read/write API.
So, the description table is a map of your network segment. However, you do not need to rewrite this table each time manually. You can fill it dynamically using data from SD card or fill it according to data from JSON file. This descriptor should be created before the start of Modbus stack. If your network map is changed you can stop stack then update the table then start communication again.
If this does not work for your application for some reason you can use the ModbusMaster wrapper CPP class to access the registers or even use the mbc_master_send_request() API in your esp-idf application (do not require the descriptor table in this case).
https://github.com/alisitsyn/modbus_sup ... aster/main
Who is online
Users browsing this forum: Baidu [Spider], Bing [Bot] and 84 guests