1

I'm using django to develop a monitoring system. This monitoring system uses the Modbus RTU communication protocol. A device can be used to use the inline form, as a device can have multiple records, this device is working properly. What happens is that I can't get the saved bank, because it needs the slave's data and the registration number to request the information. I'm using the mimimalmodbus library. Note: I can't get the slave_id and register_number from the database.

My code is in Views.py in django

instrument.serial.stopbits = 1
instrument.serial.timeout = 0.05 # seconds
instrument.serial.xonxoff = False
instrument.precalculate_read_size = False
instrument.mode = minimalmodbus.MODE_RTU # rtu or ascii mode

instrument = minimalmodbus.Instrument('/dev/ttyUSB1', 1)
a =instrument.read(register_number , slave_id)
lopes
  • 29
  • 3
  • [MODBUS](https://modbus.org/specs.php) is a fairly simple protocol; to retrieve data you need to know the slave id and which register(s)/coil(s) you need (along with things like which port to communicate on). Please add more detail to your question (providing an example of a device you wish to communicate with and the specific issue you are encountering may help). – Brits Jan 17 '22 at 20:45

0 Answers0