[McHUG] Don't trust the comments!

Rich Mitchell geobra at att.net
Wed Dec 3 09:50:48 EST 2008


McHUGgers,

Sometimes comments do more harm than good.  I wanted to get an LCD hooked up with my BBB and use it in conjunction with the DDS-60.  I found an old LCD with serial converter for the PicAXE.  I had gotten it from Brian Riley at the last Atlanticon.  I wanted to use it in a 4 wire setup.  The ribbon connector that came with it was 2x7, not directly usable with a breadboard. 

By the way, here are your pinouts for the generic LCD as found on the Freeduino INDEX.

Pin-Description
1—Ground
2—+V
3—Contrast
4—Register Select (RS)
5—Read/Write (R/W)
6—Enable (E)
7—Data Bit 0 LSB (D0)
8—Data Bit 1 LSB (D1)
9—Data Bit 2 LSB (D2)
10–Data Bit 3 LSB (D3)
11–Data Bit 4 LSB (D4)
12–Data Bit 5 LSB (D5)
13–Data Bit 6 LSB (D6)
14–Data Bit 7 LSB (D7)
15–Backlight -
16–Backlight +

So I made up a converter on a scrap of PC board that would convert the 2x7 to 7 in-line pins and v+ and ground.  Hooking up RS, RW and E was straight forward, but what do you hook up for the data?

Since I was going to use the LiquidCrystal library I decided to steal shamelessly the code from their Serial example.  Here are comments from that code:

// LiquidCrystal display with:
// rs on pin 12
// rw on pin 11
// enable on pin 10
// d0, d1, d2, d3 on pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

So I hook up d0 - d3 to the remaining 4 pins, plug it into my breadboard, plug the ribbon cable into it, download my program and no cigar!  So I download the LCD "Hello World" program - still nothing.

I go back to the INDEX, find the tutorial on the LCD library and read this:

Syntax

LiquidCrystal(rs, rw, enable, d4, d5, d6, d7)
LiquidCrystal(rs, rw, enable, d0, d1, d2, d3, d4, d5, d6, d7)

Parameters

rs: the number of the Arduino pin that is connected to the RS pin on the LCD

rw: the number of the Arduino pin that is connected to the RW pin on the LCD

enable: the number of the Arduino pin that is connected to the enable pin on the LCD

d0, d1, d2, d3, d4, d5, d6, d7: the numbers of the Arduino pins that are connected to the corresponding data pins on the LCD. d0, d1, d2, and d3 are optional; if omitted, the LCD will be controlled using only four data lines.

The example comments had the wrong data pins.  Four quick resolders and I'm back in business.  So don't trust the comments!

By the way, the 160 gB, 6 cell Acer Aspire One is offered on Amazon.com for $379.99, free shipping (if USPS leaves packages in a safe enough place) and probably no tax.

Rich

--
McHUG - Physical Computing ;)
MicroController Ham User Group


More information about the McHUG mailing list