Driver - SparkFun Serial Enabled LCD 2.5 Driver

[title]SparkFun Serial Enabled LCD 2.5 Driver[/title]
http://code.tinyclr.com/project/434/sparkfun-serial-enabled-lcd-25-driver/
[line]
Driver for the SparkFun serial enabled displays (http://www.sparkfun.com/search/results?term=serial+enabled+lcd&what=products). This driver is for the display version 2.5 (http://www.sparkfun.com/datasheets/LCD/SerLCD_V2_5.PDF).

@ tarannar
Good work!
I was looking at your driver and noticed that it was derived from IDisplay which wasn’t defined.

public class SparkFunSerialCharacterLcd : IDisplay

Please add that to the code or in an attached zip file.

Thanks.

@ jasdev
Good catch. IDisplay is a “future planning” type of interface that isn’t fully thought out. I’ve removed the IDisplay reference in the code for now.

@ tarannar
Good work.

I’ve been playing around with a serial LCD lately too, but I’ve been using the I/O pins instead of the serial interface. Nevertheless it seems that many serial LCDs are driven by a HD44780-compatible chip, no matter how the connection is physically made.

So I am wondering if there are any practical approaches to build an abstraction layer for those LCDs (actually something that your IDisplay interface was probably aiming at).

I could think of separating the control commands (like cursor movement, clear) from the bits send on the wire (either serial or multiple I/O ports, with helper classes for Gadgeteer Extender, FEZ_Pin.Digital or NETMF OutputPort), and then even put some higher level function on top, like displaying centered, right-aligned texts or some other useful stuff.
I’ve implemented some parts of this idea in my own serial LCD driver (http://code.tinyclr.com/project/432/serial-lcd-abstraction-layer-for-hd44780-displays/) but I’ve mostly adapted the GHI LCD code without implementing as much display-specific functions like you did.

To cut a long story short: if anybody is going to build such an abstraction, I’d like to join in and help.

@ Nils

Yes, the interface I started was related to two different serial displays which I have. I expect to improve the interface over time with additional displays and working with Gadgeteer (have boards but still working with Domino right now). However, the interface effort will have to wait right now as I’m working on a real world application with some tight deadlines.

Hi NIls,

I am trying to use your classes with FEZ Panda II using the following code:


SerialLCDDisplay lcd = new SerialLCDDisplay(
                  (OutputPort)FEZ_Pin.Digital.Di21, // RS 
                    (OutputPort)FEZ_Pin.Digital.Di23, // ENABLE
                    (OutputPort)FEZ_Pin.Digital.Di25, // DB4 
                    (OutputPort)FEZ_Pin.Digital.Di27, // DB5
                    (OutputPort)FEZ_Pin.Digital.Di29, // DB6 
                    (OutputPort)FEZ_Pin.Digital.Di31); // DB7

I can’t explicitly cast FEZ_Pin.Digital => OutputPort.

Can you please tell me how I can use it ?

Thanks.

@ tarannar
I am trying to use your classes with FEZ Panda II using the following code:


SerialLCDDisplay lcd = new SerialLCDDisplay(
                  (OutputPort)FEZ_Pin.Digital.Di21, // RS 
                    (OutputPort)FEZ_Pin.Digital.Di23, // ENABLE
                    (OutputPort)FEZ_Pin.Digital.Di25, // DB4 
                    (OutputPort)FEZ_Pin.Digital.Di27, // DB5
                    (OutputPort)FEZ_Pin.Digital.Di29, // DB6 
                    (OutputPort)FEZ_Pin.Digital.Di31); // DB7
 

I can’t explicitly cast FEZ_Pin.Digital => OutputPort.

Can you please tell me how I can use it ?

Thanks.

you need to cast them to cpu.pin. The example code even shows this.