Using an Arduino Mega to build an Electrical Submersible Pump Fuzzy Controller.
The application implements a modbus master to query peripherals in one serial port, and a modbus slave to answer scada system in the other port.
No problems so far, but whenever any of the peripherals becomes unresponsive, the synchronicity of the master modbus makes the system hang waiting for response, thus delaying the control program and missing scada requests.
What do i need? An asynchronous modbus master implementation, so that i could query peripherals and move on, and treat the results later on data arrival or timeout, but without hanging waiting for response.
Maybe something is deadlocking (e.g. writing to UART when inside I2C event). You need to figure out what it is or show the code.
Looking at a MCP2551 CAN transceiver
I can see it looks a lot like an RS485 transceiver... which brings us to the next issue, what sort of bus is being used. At least the Fuzzy part of the design is clear.
"Fuzzy", really is that a good meme to mix with "Electrical Submersible Pump Controller".
Sounds like a poor implementation of the modbus library, either within your program or within the library. Which library would that be?
I have modbus setup to scan for new devices on the bus, which means it frequently attempts to connect to devices that do not exist. The same unit also provides data to the serial monitor and SD card, and I don't have an issue with missing data while waiting to timeout on devices that are not responsive (do not exist).
adwsystems:
Sounds like a poor implementation of the modbus library, either within your program or within the library. Which library would that be?
I have modbus setup to scan for new devices on the bus, which means it frequently attempts to connect to devices that do not exist. The same unit also provides data to the serial monitor and SD card, and I don't have an issue with missing data while waiting to timeout on devices that are not responsive (do not exist).
I am pretty sure you are right and that you have the solution, we just need to clarify the problem. Could you try to guide me thru this?
Check this library, it implements the master using a polling, so non-blocking. It might fit your needs. The best: the same library also implements the slave part, so you don't need the space for two libraries.
pylon:
Check this library, it implements the master using a polling, so non-blocking. It might fit your needs. The best: the same library also implements the slave part, so you don't need the space for two libraries.
Thanks mate! gonna test it asap and tell the results!