Pages: 1 2 [3]   Go Down
Author Topic: [SOLVED]LCD 16x2 showing garbage  (Read 7853 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Got it.  The shield I'm using is this one: https://www.adafruit.com/products/243.  I set up the LCD using this tutorial http://learn.adafruit.com/character-lcds/wiring-a-character-lcd.   Of course I had suspected a conflict between the LCD and either the SD card or the Serial comm since I could place the LCD print code before initialization and it worked fine.  I searched around the net to find potential conflicting pins.  The last pin I changed was the DB7 from pin 12 to pin 0.  I also tried pin 1.  The results are the same. Text displays correctly at the beginning of the Setup() function but displays random characters that generally look alike if the code is placed below the initialization of either the SD or the serial.  I get that there are potential conflicts.  This is a community project and the others had earlier hardwired pins 2-4 so these are not an option.  I guess the question is, if the SD card uses pins 10, 11, 12, and 13; and the serial uses 0 and 1, and I'm already using 2-4 for the sensor, and 5,6,7, 8, 9 for the LCD, then the DB7 pin which was on 12 then I placed on 1, then 0 and I had the same results, then I'm stuck without any pins - unless I can use an analog pin, which I haven't tried yet.  BTW, the garbage was nothing near what it should have been, randomly place on the screen and odd ascii chars.
thx
Logged

Dee Why NSW
Offline Offline
Full Member
***
Karma: 5
Posts: 206
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I guess the question is, if the SD card uses pins 10, 11, 12, and 13; and the serial uses 0 and 1, and I'm already using 2-4 for the sensor, and 5,6,7, 8, 9 for the LCD, then the DB7 pin which was on 12 then I placed on 1, then 0 and I had the same results, then I'm stuck without any pins - unless I can use an analog pin, which I haven't tried yet. 

The LCD is just a module and you should be able to wire it where you like, including the analogue pins, rather than suffer the constraints of a shield. I had a similar clash between an LCD shield and the SD. I was obliged to run a jumper across a proto shield and thereby use A2 (16) for the LCD.  The SD will surely use 11,1,2,13 but the select is usually on D4, so you need to be certain of that.

It can pay to use a spreadsheet with lots of colour in order to sort the pins out
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The shield schematic clearly says D10-13 are used for the SD card and A4-A5 are used for real time clock. Then Leonardo uses D0 and D1 for hardware serial. Use any other pins, including A0-A3 analog pins. D4 is NOT used by the shield. Nick said with a "usually" which means he did NOT read the schematic, AGAIN!!!  smiley-razz smiley-razz smiley-razz

Here it is:
http://www.ladyada.net/images/logshield/logschemv1.png

You can also buy a backpack from my store to save all your pins:

http://www.inmojo.com/store/liudr-arduino-and-physics-gadgets/item/serial-lcd-back-pack---phi-panel/

Will do you a lot good compared with its price.

BTW, is your RTC working? I suppose not but let me know. I have the same shield but don't have Leonardo.
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Guys, with  your help, I resolved it.  Here is the final config that worked: LiquidCrystal lcd(7,8,9,A2,A1,A0)
Karma, I love your backpacks - will pick a couple up.
Thanks.
Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 32
Posts: 4259
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Karma, I love your backpacks - will pick a couple up.

That 'Karma' guy must have carpal tunnel syndrome by now.

Don
Logged

Pages: 1 2 [3]   Go Up
Jump to: