I have an Arduino (168) and am trying to run a SparkFun 16x2 LCD display with it. I have read the tutorial for SparkFun LCD's on the Arduino website, but I can only get the screen to dump characters onto the screen. I am very new to electronics and this sort of programming so any help or a link to a good online tutorial would be very much appreciated. Thanks.
... I can only get the screen to dump characters onto the screen.
What is it you want other than characters on the screen? Maybe I don't understand what you need help doing. Can you be more specific about what you expect to get, compared to what you are getting?
You'll want to use the LiquidCrystal library. A nice tutorial has been setup here:
I should note that the library has been updated but it is not included int the 0016 package, you'll have to manually update the library yourself (drag and drop files, it's easy).
I would not recommend using the old LiquidCrystal library as it has timing issues that were never addressed until recently. I've used both and the new library is a little slower but about 100 times more reliable. The old library has been known (and i've personal had it happen) to throw garbled text on the screen or not putting text on at all.
It's a good tutorial with good examples, give it a look over.
TBAr, the character dump is simply random characters. I can't control what is on the screen, only that weird characters are.
Skinner, the LCD I have is a serial display and the tutorial you showed me, I have seen before, but it is for a parallel display. Any help on getting this serial LCD to work would be appreciated. Thanks.
I don't have one of these, and it's a bit hard to tell without more symptoms, but two things to check come to mind.
My first guess, although pardon me as this is a bit obvious and you've probably already triple checked it, would be to see if your Arduino is transmitting at the right rate (looks like 9600bps, from the Sparkfun site). If it's not exactly the same speed, the display will know there is incoming serial SOMETHING but it won't be able to understand it as meaningful data.
My second guess would be that something is out of synch. I can't quite see how this can happen with the setup you describe, where it's handled for you, but starting on the wrong bit is a very reliable way to get nonsense out of serial. You should at least be able to get repeatable blocks of nonsense this way... can you?
+1 for checking the speed needing to be 9600 bps. Paul Badger's moderndevice.com site has a great set of docs related to LCD screens, and what he has seems to indicate that the LCD itself my be locked into 9600bps transmission speed, so you'll have to run your serial connection at that speed in order for it to work correctly. I just ran into this where I'm running an arduino mega serial connection to my machine at 57600bps and I have to run 9600bps to the serial LCD board in order for it to work... so... I experience a slight slowdown to my 57600 data stream while the 9600bps data stream is doing it's thing. Fortunately, it doesn't seem to make much difference for my 57600bps activity...
Thanks guys. I did have it set correctly at 9600bps. My problem was in the serial commands I was sending. I was sending the incorrect commands so after an hour or so of trial and error, I finally got my text to display. I still have a ways to go in understanding how to set some of the command parameters, but I'm getting there. Thanks for the suggestions.
Glad to hear you got it working. Mine is still in the post…
I'm having similar trouble. I followed someone else's suggestion of adding a delay(100) immediately after starting the SoftwareSerial port for the LCD. This allows it time to boot up before sending the first message, and could explain missing bytes at the beginning.
Still trying to work out some other bugs though...