STM32F0 Discovery board and the HD44780 LCD!

As with nearly all of my posts, this one too starts with a really cheap eBay buy (£1.25, example: – Link will expire!). The HD44780 LCD (Datasheet: is a pretty versatile component supporting 16 characters and 2 rows, implementing some cool functions like display shift and text scrolling. It uses an 8bit or 4bit parallel interface and is pretty slow so works with nearly any microcontroller. It has its own inbuilt CGRAM (character generation RAM) which contains all standard characters plus a few more Chinese characters. It is possible to write your own characters to the CGRAM though I haven’t included this in my example and for most applications, it isn’t needed.

In my simple application, I’m initializing the screen and writing a string to the screen. I’ve also got a “Demo” function which causes the string “Hello World!” to bounce from left to right and back on the top row. Obviously a completely useless function, though somewhat cool!

The code for the LCD can be found on my github and I’ll link to that at the bottom of the page.

With regards to wiring, I merely soldered a standard pin header to my LCD and wired it up using a bread board! I need to implement a capacitive voltage inverter in the near future as the LCD doesn’t have enough contrast running at 3v. My solution to this was to run it at 5v as the LCD is currently only being used in read only mode anyway!

I’ve added a 120 ohm resistor in series with the backlight LED just in case it doesn’t have internal current limiting. The brightness could be controlled using a PWM module in the STM32F0, along potentially controlling the contrast too! To set the contrast, I use a 3.3k ohm resistor from the “Vo” terminal to ground. The rest is pretty simple wiring.

Talking of which, the wiring goes:
LCD Vss – Gnd
LCD Vdd – 5v
LCD Vo – Gnd through a 3.3k resistor
LCD Rs – GPIOA, Pin 0
LCD RW – Gnd
LCD En – GPIOA, Pin 1
LCD D4 – GPIOA, Pin 2
LCD D5 – GPIOA, Pin 3
LCD D6 – GPIOA, Pin 4
LCD D7 – GPIOA, Pin 5
A (LED anode) – 5v through a 120 ohm resistor
K (LED cathode) – Gnd

P1020460Hello world! I had to take it at an angle because the LCD brightness was confusing my camera!

P1020461Top down view of the LCD, as you can see, my camera doesn’t like taking pictures of the LCD.

Hopefully a better view of the wiring. You can see the 120 ohm and 3.3k ohm resistors.

P1020463Another angle of th wiring, the 3.3k resistor is much more visible here!

My github containing the Coocox project is:

In the future, I’ll probably be adding a capacitive voltage inverter using an STM32F0 GPIO pin and potentially upgrading to a 3 pin interface using a shift register!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s