The short answer to your question is no, there is now way to provide non blocking i/o to a character LCD using existing libraries.
To write your own code to do that is massive undertaking, and even then I'm not sure you would end up much better off than some of the already available alternatives.
While I know it is very common practice these days, not just in Arduino code, but all over the place to write code that essentially does some sort of polling so it very much depends on a particular speed of some sort of looping code, IMO, it is very bad practice and it concerns me greatly.
i.e. if "bad" things can happen, or there is a poor user experience if there are intermittent delays or the "loop" has variable timing, then, IMO, the overall s/w design for the project is wrong.
My question in this case i how much time is too long when updating the display?
is 25ms too long to print your 15 character message to the LCD?
There are several ways to reduce that. Like:
- updating the display less often (doesn't reduce the actual update time, but reduces the frequency of delays)
- only printing what has changed,
- changing to a better/faster library
- running the i2c bus faster.
The hd44780 library is much faster than other LCD libraries.
If you don't have any 100khz slaves on bus, you could also run the i2c bus a 400Khz as most PCF8574 chips will operate at 400 kHz.
When using hd44780 library hd44780_I2Cexp i/o class and running 400Khz, you will get LCD update times that are actually faster (and hence lower delays) than using the LiquidCrystal library which uses Arduino pins to directly control the LCD.
For Example here are the transfer times needed to send a single character to the LCD:
1487 us LiquidCrystal_I2C
555 us hd44780 hd44780_I2Cexp i/o class
284 us LiqudCrystal
205 us hd44780 hd44780_I2Cexp i/o class @ 400 khz
Using that, you can calculate the timing delay overhead to send 15 characters based on the h/w and library used.
With the LiqudCrystal_I2C library you would be blocked for 22.3ms whereas when using the hd44780 library at 400kHz it would reduce to around 3ms
So you can see, without changing anything, the blocking time for LCD updates can be reduced by a factor of 3 by just changing to the hd44780 library and by a factor 7 by changing to the hd44780 library and running the i2c bus a 400khz.
Other things like updating less often and only printing what has changed are also very effective at reducing overheads.
--- bill