Basicly I want to make a I2c controled lcd, but I can't find any good schematics or source code,
would this be even possible with this i/o expander?
MCP23016
any way, any help would be apriciated,
and please don't go LMGTFY,
I googled, a lot but it's either not code/library, or no hardware schematics,
this is really hard for me to understand so,
I am willing to learn but It needs to be on a newb lvl
would this be even possible with this i/o expander?
MCP23016
Yes perfectly possible, but you might have to do a bit of work.
I use the 23016 in this project:- http://www.thebox.myzen.co.uk/Hardware/Pendulum.html
Down load the schematics and the schematic of how to connect it to an arduino is there, along with code functions to drive it.
Now wire it up to the LCD, I assume you are using 4 bits of data so you have a choice of what side of the expander to use along with what wires to connect to what pins.
Now take the LCD library and one of the last functions in the code is the bit that actually outputs the data to the pins. Replace those few lines with calls into those functions you copied from the pendulum project, with the appropriate data values, and there you have it.
I suggest that you start here Arduino Playground - I2CPortExpanderAndLCDs which is the third hit I got using your search terms. It uses a 23008 which is essentially half of a 23016 so the required code modifications should be minimal. His LCD initialization is close to the recommended but not exactly correct -- it will probably work.
His (bristolwatch) LCD initialization is even worse than the one in the playground which is why I didn't recommend that link before. I just can't understand what is so hard about following the sequence that is in the datasheet.
His code is commented more completely than most so that will help.
Try going through the code and figuring out where all the 'magic numbers' come from.
For example this part deals with the LCD controller. You will have to use your Google skills to come up with a data sheet for the HD44780 controller. Then you will have to look through that data sheet to find the 'Instructions' that the controller uses. Finally you have to compare the magic numbers with the instructions. Unless you are fluent in Hex you should convert the magic numbers to binary. If you try converting everything to decimal you are doomed.
const byte HOME = 0x02;
const byte CL = 0x10; // cursor left
const byte CR = 0x14; // cursor right
const byte SL = 0x18; // Shifts entire display left
const byte SR = 0x1c; // Shifts entire display right
Don
Edit: Homework - (1) explain why this is so: The address of the MCP23016 is 0x20.
(2) explain how to change it.
(3) explain why you might want to do so.