GS0108 on I2C

Hi, I began developing a modified version of the library you find here (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1245459243) that uses a PCF8574 option to drive the GLCD. The major advantage of doing this is simple: you save a hell lot of pins. The GS0108 uses 13/14 (depending wether you use Reset or not) pins on the Arduino. This is, in my opinion, more than a good reason to use a I2C chip to drive it.. or rather, two chips. Basically the library uses two PCF8574 chips, one as Command register, one as Data register (5/6 command Pins, 8 Data pins). The ICs itself are connected to the Arduino analog ports 4 and 5 (besides various GND and 5V ports). So in the end you save 12 pins.. if that isnt something. The Library is tried to be included neatly into the existing library so you can switch between the old - and the one new option. Using either Arduino, mega, Sanguino or PCF8574 as interface..

As i have just 'completed' the most basic parts - all in all simply adding a #ifndef TWIEXPANDER parts arround the existing cmd and data output codelines and added the corresponding i2c functions i thought i was done. Unfortunately all i get are bogus results. Sometimes i get some random output, sometimes i get nothing at all.. so i would be very happy if someone would like to help me with that as the possibilities with those chips and the LCD (128x64 in my case) are quite good.. So, if someone wants to help me - i will post the code here... i will do my best to debug it myself, but some helping hand is always appreciated ,0)

Code: shalmirane.de/ks0108.rar

Changelog: 0.1: Code completed. New header, definitions and functions made.. Still buggy.. sometimes i get bogus output, or rather more likely - nothing at all.

Hi Nachtwind, the thread you linked started with the code from here: http://en.radzio.dxp.pl/ And ended up with code from here: http://www.arduino.cc/playground/Code/GLCDks0108

Which one are you using?

If you are using the playground library, I would be happy to look at your code to see if I can help get it working.

edit After having a second and closer look to the playground code i think i will edit that one - it looks to be far easier for being modified as tis one isnt so loaded with stuff.. I think i will try to get that one to work with the I2C chips today..

edit2 http://shalmirane.de/ks0108.rar

THis is my experiment with the code from the playground... strangely enough it shows the same error that had the other lib - i have one half of my screen in black, the other half in white. I guess its some quite simple error somewhere.. but i cannot find it unfortunately. Also.. my 2nd PCF could have gone to nirvana last night - it was late and i simply installed it upside down... and powered it for half an hour or so... At the moment it looks like this: If i attach a LED on one of the command chips pins (EN for example) it looks like the LED is dimmed via PWM - if i put it on any of the data pins it shins in bright color - like attached to 5V... so i guess the problem may be on my side as well.. So, if one would like to give it a try he or she is welcome, i think i will get a new expander before testing more of the code..

edit3 I have just removed my 2nd chip (the one on the data lines) - same result as before - yet i have attached a LED on a data pin and GND - it shines.. is there something set up wrong with the way the LCD shoudl work?!