Go Down

Topic: My first (serLCD) library => useful for beginners? (Read 1 time) previous topic - next topic

albinoblacksheep

Hi people!

I started arduinoing a couple of weeks ago, and now I just finished my first entirely self-written library.
Its a real beginners work, but I worked through it step by step, commenting every detail, to make things come clear to me. When I write things down, I understand an remember them better. This is why I thought maybe this could be interesting for some other beginners like me, since the code is  commented fairly in detail, so it might help the one or another to understand the context and connections between a header file and a library a bit better, and how a library is used.
Even if you don't need a library for this specific serial LCD, you might still want to check these files out and use them as a "starting point" for your own first library you want to write.

I did not use the LiquidCrystal library, because I wanted to understand how a header file and a library file work together and what each of them does, so I started from scratch and wrote everything "alone".

I hope you can make use of it, if not, sorry for the waste of your forum space!
Feel free to ask me  questions or post some tips to improve this library.
Sincerely, Sebastian

ps.: please excuse my imperfect English, I hope though you will understand the general idea that I wanted to explain *g*

albinoblacksheep

#1
Feb 10, 2010, 02:01 pm Last Edit: Feb 10, 2010, 02:21 pm by albinoblacksheep Reason: 1
... and here is the code!
http://www.file-upload.net/download-2245339/SerLCD_SFE09395_Test.zip.html

and here in action: simply reading the value of a potentiometer:
http://www.youtube.com/watch?v=p3MouEL-hcw

have fun

KenH

Your English is just fine - very good.  Once I get home I'll be checking your serial LCD library. I've got a couple of serial LCD displays and have not used them as I didn't know how. Perhaps your library will help.

Serial will use a LOT less pins than a parallel LCD I've been using.

Thank you for your work.

Ken H>

albinoblacksheep

#3
Feb 10, 2010, 05:15 pm Last Edit: Feb 10, 2010, 05:18 pm by albinoblacksheep Reason: 1
Hi!

Just hook up a potentiometer to analog input 0, connect the serial LCD to VD, GND and pin 5 on the arduino and you should be good to go. There is a sample .pde, so you can try it right away, just make sure the .pde, .h and .cpp are in the same folder when you open the .pde! You should then see all 3 files opend in 3 tabs.
Let me know how it works for you!

Cheers  :)

KenH

I just got home and downloaded the file...  it opens and compiles nice.  I do have a question:  You said:
Quote
connect the serial LCD to VD, GND and pin 5 on the arduino
that is only 3 pins.  On the LCD should there not be:
voltage pin
ground pin
RX pin
TX pin?
for a total of 4 pins on the LCD connected? with RX and TX to Arduino?  Of course there is the pot pin on the Arduino also.

I sure don't know and am looking for guidance.

Thanks for all the work.

Ken H.

albinoblacksheep

#5
Feb 11, 2010, 08:28 am Last Edit: Feb 11, 2010, 08:29 am by albinoblacksheep Reason: 1
Hi KenH!

Technically you are right. A serial communication works two ways. Normally you connect the TX pin from one device to the RX pin on the other and vice versa, as to say: the RX (=receive transmission) of the LCD is connected to the TX (=transfer transmission) of the Arduino - in this sketch its pin 5 of the Arduino.

The other way round would be to connect the LCD TX to the Arduino RX pin, but in this case this connection is not needed, since the LCD only receives data, but does not send any back to the arduino. Thats why only 3 connections (VD, GND and RX/TX) are needed.

Hope I could clarify things a bit,
let me know if your LCD is talking to you *g*
Cheers!

KenH

Ahhhhh, I wondered if that was the case - and it makes sense.

Thank you - I hope to try that this weekend.

Ken H>

KenH

albinoblacksheep: I am playing with the serial library this weekend... or trying to anyway.  My "serial" LCD display is confusing me.  It has the following pins:

1 = Vcc
2 = Vss(ground)
3 = SCK
4 = SI
5 = C/D
6 = RESET
7 = BUSY
8 = CS
9 = Vlc
10 = NC

This is from a LCD with a  D7225G controller chip. Not even sure it is a serial LCD - any ideas?  This link might have the datasheet: http://www.datasheet4u.com/html/D/7/2/D7225G_NEC.pdf.html
Can anyone provide any insight to this LCD?  Will it work with your serial library?  

Which pin is the RX?

Thanks for any and all help,

Ken H>

Ahas


Prof.

KenH: That isn't a serial LCD. It's a standard one.  :-/

Ran Talbott

Quote
Not even sure it is a serial LCD

If you check the real datasheet,  you can see it's a variant of SPI.  But it has some handshaking stuff going on that's different from "normal" SPI,  so you'll probably need to do a variant of the library code to accommodate it the "BUSY" line.  You might need to hook it up to an interrupt pin,  to make sure you don't miss it being pulsed while a timer or serial interrupt is being processed.


KenH

Thanks Ran - that's why I never could figure it out.  It was sold to me as "serial" and I could never figure how to make it work. With your comment on the "variant of SPI" tells me why I can't use it. Maybe "someday" I'll know enough about this stuff to use them.

I've got 4 of them (they were cheap - $1 each?).  If you can make one work I'd be happy to send anyone (USA due to shipping costs) a freebie.... for sharing knowledge:)

Ken H>

Go Up