0
Offline
Newbie
Karma: 0
Posts: 6
Arduino rocks
|
 |
« on: February 10, 2010, 08:01:04 am » |
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*
|
|
|
|
|
Logged
|
|
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #2 on: February 10, 2010, 10:35:06 am » |
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>
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 6
Arduino rocks
|
 |
« Reply #3 on: February 10, 2010, 11:15:30 am » |
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 
|
|
|
|
« Last Edit: February 10, 2010, 11:18:56 am by albinoblacksheep »
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #4 on: February 10, 2010, 10:17:47 pm » |
I just got home and downloaded the file... it opens and compiles nice. I do have a question: You said: 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.
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 6
Arduino rocks
|
 |
« Reply #5 on: February 11, 2010, 02:28:27 am » |
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!
|
|
|
|
« Last Edit: February 11, 2010, 02:29:30 am by albinoblacksheep »
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #6 on: February 11, 2010, 07:02:42 am » |
Ahhhhh, I wondered if that was the case - and it makes sense.
Thank you - I hope to try that this weekend.
Ken H>
|
|
|
|
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #7 on: February 20, 2010, 04:44:15 pm » |
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.htmlCan 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>
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 4
Arduino rocks
|
 |
« Reply #8 on: February 20, 2010, 05:33:39 pm » |
Thank you for your post...
see ya
|
|
|
|
|
Logged
|
|
|
|
|
0
Offline
Newbie
Karma: 0
Posts: 18
Arduino rocks
|
 |
« Reply #9 on: February 21, 2010, 03:29:35 am » |
KenH: That isn't a serial LCD. It's a standard one. :-/
|
|
|
|
|
Logged
|
|
|
|
|
Rural Arizona
Offline
Edison Member
Karma: 7
Posts: 1712
Incorrigible tinkerer
|
 |
« Reply #10 on: February 21, 2010, 05:17:41 am » |
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.
|
|
|
|
|
Logged
|
|
|
|
|
Mobile, AL
Offline
Sr. Member
Karma: 0
Posts: 314
CAUTION!-Slow Learner
|
 |
« Reply #11 on: February 21, 2010, 05:31:54 am » |
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>
|
|
|
|
|
Logged
|
|
|
|
|
|