Hello,
Up untill now my projects have run off a I2C oled, but I recently got a 16x2 LCD and it's much better, but it uses many more pins than I2C.
So I have a question, is it possible for me to put this device in parallel with others ( and only write to the display when say one pin is high, then write to my servos when the pin is low ) ? ( a kind of multiplexing ? )
Or should I not bother and just get a I2C module for the LCD ?
In principal you can, but what happens to the other device while you are writing to the display? It gets erroneous signals that could disturbed it. So a servo would at the best twitch for the duration of your display access. If the output were only driving an LED then this might be acceptable but it is hard to think it is worth it.
I would use a port expander chip, either I2C or SPI and hang the display off that.
Grumpy_Mike:
In principal you can, but what happens to the other device while you are writing to the display? It gets erroneous signals that could disturbed it. So a servo would at the best twitch for the duration of your display access. If the output were only driving an LED then this might be acceptable but it is hard to think it is worth it.
I would use a port expander chip, either I2C or SPI and hang the display off that.
What pin of the LCD would I need to write to if I want it to ignore it's inputs ?
It's true I didn't think of that, I'll have to try to see if the twitching is a problem ( I would only need to write to the LCD every few minutes )
You just fail to write the the CE pin and then movement of the other pins don't matter. However how do you stop the servo pulse interfering with the data you write to the LCD?
Grumpy_Mike:
You just fail to write the the CE pin and then movement of the other pins don't matter. However how do you stop the servo pulse interfering with the data you write to the LCD?
When I'm running the sevos, CE is low ( so most of the time ) as such nothing is written to the display
When I end up needing to update LCD info, CE goes high, LCD is written to ( servos twitch ) and then CE goes back to low and my servos can resume their movement.
Thank you for your help, I'll test the CE idea but it seems like a I2C module is more feasible
Assuming you can work out the pin sharing.
(keeping the servo library ISR routines from mucking with the pin being used to control the LCD)
Keep in mind that a call to update the LCD using the stock LiquidCrystal library can take quite a while. i.e. 100's of microseconds per character being written. And if you do a clear() or home() that is 2ms for either of those.
So just writing a string of say 10 characters, will be several milliseconds.
That is a long time to block servo signals if you lock out the servo during the LCD update.
bperrybap:
Assuming you can work out the pin sharing.
(keeping the servo library ISR routines from mucking with the pin being used to control the LCD)
Keep in mind that a call to update the LCD using the stock LiquidCrystal library can take quite a while. i.e. 100's of microseconds per character being written. And if you do a clear() or home() that is 2ms for either of those.
So just writing a string of say 10 characters, will be several milliseconds.
That is a long time to block servo signals if you lock out the servo during the LCD update.
i2c LCD modules are less than $1 USD.
--- bill
INTP:
I2C modules are worth their price just for the included contrast pot, imo.
Thank you for the info
I managed to get it working, using the analog pins as digital ones for the display
Thanks all for the help ! ( I already have another question, but I can't delete this thread, should I create a new thread ? )