ATMega168A standalone with 16x2 LCD


I'm struggling getting this display to display what I want.

I've uploaded the HelloWorld sketch and the display is only showing gibberish and squares on line 1.

My connections are as in the HelloWorld sketch, and I've used the ATMega168 pin map to connect according to the sketch:

PD5 -> D4 PD4 -> D5 PD3 -> D6 PD2 -> D7

PB4 -> RS PB3 -> EN

I've got a 10K pot on the contrast pin. When I connect it as this on mu Mega 2560 board, it all work OK.

I've connected a LED on PB1 and use digitalWrite(9, HIGH); to see if I've connected the MISO; MOSI; SKC right. The LED turns on as expected. But the LCD on the other hand...

Any pointers?

OS: Ubuntu32 14.04 Arduino 1:1.0.5+dfsg2-2 AVRISP MK II

  • nerdegutta

Did you connect LCD pin 5 (R/W) to GND?

Why have you mentioned MISO, MOSI, and SCK?


I'll be damned!

I have no idea what just happened.

I disconnected the AVRISP MKII and removed the power to the breadboard, and put it aside, to work on some other project while I waited for some answers on this question.

When I reconnected the AVRISP, and the power, and uploaded the skecth again, it works.

I guess I had a quick visit from Mr. Murphy.

Thanks anyway!

  • nerdegutta.