Driving an HD44780 LCD using atmega328P @12MHZ 3.3v

Hi
I'm having trouble driving hd44780 lcd @12mhz. I've written custom board entry in the boards.txt

uno.name=Arduino Uno 12MHZ
uno.upload.protocol=arduino
uno.upload.maximum_size=32256
uno.upload.speed=115200
uno.bootloader.low_fuses=0xff
uno.bootloader.high_fuses=0xde
uno.bootloader.extended_fuses=0x05
uno.bootloader.path=optiboot
uno.bootloader.file=optiboot_atmega328.hex
uno.bootloader.unlock_bits=0x3F
uno.bootloader.lock_bits=0x0F
uno.build.mcu=atmega328p
uno.build.f_cpu=12000000L
uno.build.core=arduino
uno.build.variant=standard

I successfully compiled and uploaded the sketch using avrismpMKII programmer but the lcd isn't displaying any text. There are also only 20 squares lit up however it's a 20x2 LCD. I was successful in driving it when I was using just an arduino uno. However the one wire thermocouple am using is 3.3v only on the data lines Hence am driving this @12MHZ so I can power the mega @ 3.3v instead of 5v.

Also I was told I can use diodes to protect the Arduino from the lcd, which pins do I need this on?

You are not giving us enough information.

There are also only 20 squares lit up however it's a 20x2 LCD.

Which 20 squares are displayed? The top 20 indicate one problem, the left 20 indicate another.

Hence am driving this @12MHZ so I can power the mega @ 3.3v instead of 5v.

Did you actually change the resonator or are you just telling boards.txt that you did??
What voltage are you running the LCD at?

Also I was told I can use diodes to protect the Arduino from the lcd, which pins do I need this on?

I suppose you should ask the source of this information. Normally, unless you are implementing LCD pin 5 the LCD will not send any information back to the Arduino so I'm not sure what you are protecting it from.

Don

Upon further reflection it seems most likely that you are running your processor at 16 MHz with a 3.3 volt supply. That would probably work even though it is outside the device specifications.

The problem is that you told the IDE that you are running the device at 12 MHz. This means that the bootloader is not working properly and that your program code is not being received by your processor.

As a result the LCD is not being properly initialized and you see the well known symptom of a single row of blocks on the display.

You really should consider running the system at the recommended 5v and conditioning the signals between your processor and your sensor.

Don