Hi !
Tell me how to make a non-blocking (asynchronous) Modbus RS485 mode.
On a standard library or another library that allows you to make a non-blocking Modbus
Non-blocking (asynchronous) Modbus RS485 mode ?
Non-blocking (asynchronous) Modbus RS485 mode ?
for a single processor device non-blocking normally means one of 3 things
- polling
- interrupts
- event driven (e.g. event loop)
---
- polling
this is easy Serial.available() tell you if you have data in the buffer waiting to be read
e.g. viewtopic.php?p=15912#p15912
- interrupts
in a certain sense, the default implementation already does that
https://github.com/stm32duino/Arduino_C ... o/Serial.h
https://github.com/stm32duino/Arduino_C ... Serial.cpp
so that all you need to do is to check Serial.available() before reading.
but that if you insist, you could make your own custom version of a (hardware/uart) serial interface.
- event driven
in a certain sense, the default implementation already does that, the received data is placed in a ringbuffer
and all you need to do is check Serial.available() before reading
e.g. viewtopic.php?p=15912#p15912
same as polling
if you want anything more elaborate you could wrap an elaborate event loop
https://github.com/ag88/stm32duino-eventloop
and do a time driven (polling) Serial.available() check, but through the event loop.
Go to full post- polling
- interrupts
- event driven (e.g. event loop)
---
- polling
this is easy Serial.available() tell you if you have data in the buffer waiting to be read
e.g. viewtopic.php?p=15912#p15912
- interrupts
in a certain sense, the default implementation already does that
https://github.com/stm32duino/Arduino_C ... o/Serial.h
https://github.com/stm32duino/Arduino_C ... Serial.cpp
so that all you need to do is to check Serial.available() before reading.
but that if you insist, you could make your own custom version of a (hardware/uart) serial interface.
- event driven
in a certain sense, the default implementation already does that, the received data is placed in a ringbuffer
and all you need to do is check Serial.available() before reading
e.g. viewtopic.php?p=15912#p15912
same as polling
if you want anything more elaborate you could wrap an elaborate event loop
https://github.com/ag88/stm32duino-eventloop
and do a time driven (polling) Serial.available() check, but through the event loop.
Re: Non-blocking (asynchronous) Modbus RS485 mode ?
for a single processor device non-blocking normally means one of 3 things
- polling
- interrupts
- event driven (e.g. event loop)
---
- polling
this is easy Serial.available() tell you if you have data in the buffer waiting to be read
e.g. viewtopic.php?p=15912#p15912
- interrupts
in a certain sense, the default implementation already does that
https://github.com/stm32duino/Arduino_C ... o/Serial.h
https://github.com/stm32duino/Arduino_C ... Serial.cpp
so that all you need to do is to check Serial.available() before reading.
but that if you insist, you could make your own custom version of a (hardware/uart) serial interface.
- event driven
in a certain sense, the default implementation already does that, the received data is placed in a ringbuffer
and all you need to do is check Serial.available() before reading
e.g. viewtopic.php?p=15912#p15912
same as polling
if you want anything more elaborate you could wrap an elaborate event loop
https://github.com/ag88/stm32duino-eventloop
and do a time driven (polling) Serial.available() check, but through the event loop.
- polling
- interrupts
- event driven (e.g. event loop)
---
- polling
this is easy Serial.available() tell you if you have data in the buffer waiting to be read
e.g. viewtopic.php?p=15912#p15912
- interrupts
in a certain sense, the default implementation already does that
https://github.com/stm32duino/Arduino_C ... o/Serial.h
https://github.com/stm32duino/Arduino_C ... Serial.cpp
so that all you need to do is to check Serial.available() before reading.
but that if you insist, you could make your own custom version of a (hardware/uart) serial interface.
- event driven
in a certain sense, the default implementation already does that, the received data is placed in a ringbuffer
and all you need to do is check Serial.available() before reading
e.g. viewtopic.php?p=15912#p15912
same as polling
if you want anything more elaborate you could wrap an elaborate event loop
https://github.com/ag88/stm32duino-eventloop
and do a time driven (polling) Serial.available() check, but through the event loop.
Re: Non-blocking (asynchronous) Modbus RS485 mode ?
ag123 wrote: Sun Jun 21, 2026 2:44 am for a single processor device non-blocking normally means one of 3 things
- polling
- interrupts
- event driven (e.g. event loop)
Thank you so much for your very detailed and wonderful response!
Great!