In this tutorial, I will share about LCD 16x2 library. With this library, you can easily use LCD 16x2 with STM32F103 microcontroller. This library contain 2 file: lcd16x2.h and lcd16x2.c files. If you want to know the more detail how the LCD 16x2 works, you can see this tutorial.
Showing posts with label LCD 16x2. Show all posts
Showing posts with label LCD 16x2. Show all posts
Saturday, April 23, 2016
Sunday, December 20, 2015
LCD 16x2 HD44780 Tutorial 6 - 4-bit Data Transfer
In this tutorial, I will share hoe to use 4-bit data transfer between to the LCD 16x2. This technique is useful when we want to control LCD from microcontroller, because it use less GPIO pins. 4-bit interface is only used 4 wire from D7 to D4, D3 to D0 is not used. The transfer method is high nibble first, then followed by low nibble.
This is the procedure how to use 4-bit data transfer to display 'A' character:
- Send command: 0b0010 xxxx (Set 4-bit data transfer).
- Send command: 0b0010 xxxx (high nibble function set).
- Send command: 0b1000 xxxx (low nibble function set).
- Send command: 0b0000 xxxx (high nibble display on, underline on, blinking on).
- Send command: 0b1111 xxxx (low nibble display on, underline on, blinking on).
- Send data: 0b0100 xxxx (high nibble 'A').
- Send data: 0b0001 xxxx (low nibble 'A').
Saturday, December 19, 2015
LCD 16x2 HD44780 Tutorial 5 - Create Custom Character
In this tutorial, I will share how to create and display custom characters on LCD 16x2. First thing you must know is that on the LCD 16x2 there are two memories that storing defined characters, CGROM and CGRAM.
CGROM is used for storing all permanent font that can be displayed by using their ASCII code. For example, if we write 0x41 then on the display will show 'A' character. CGROM memory is non-volatile and can't be modified.
CGRAM is another memory that can be used for storing user defined characters. This memory is volatile and can be modified any time. This memory can store up to 8 user defined characters. Characters that stored in CGRAM can be accessed from code 0x00 to 0x07.
This table below show character codes and character patterns for CGRAM and CGROM:
Sunday, September 20, 2015
LCD 16x2 HD44780 Tutorial 4 - Character Entry Mode
In this tutorial, I will discuss about character entry mode of LCD 16x2 HD44780. There are 4 character entry mode that can be selected. So far, we have been used the default character entry mode until previous post. The entry mode is auto-incrementing the cursor address every new character is entered. It is also possible to auto-decrementing the cursor and combine with shifting the display.
This is the first entry mode or the default entry mode. To do this we can send instruction 0b00000110 to the LCD. This is the default entry mode every LCD powered on. Every new character is entered, the cursor/ DDRAM address is auto-incremented by 1. This mode is illustrated by picture below:
- Set cursor to 0x07 address location.
- Put char 'A' on 0x07 location, cursor auto-incremented to 0x08 address location.
- Put char 'B' on 0x08 location, cursor auto-incremented to 0x09 address location.
- Put char 'C' on 0x09 location, cursor auto-incremented to 0x0A address location.
- Return home (0x00 location).
Saturday, September 19, 2015
LCD 16x2 HD44780 Tutorial 3 - Display Address and Shifting
In previous tutorial, we have done displaying a word "AnNyeongHaSeYo!" (Hello in Korean) on LCD 16x2. In this tutorial, I will explain about addressing to DDRAM (Display Data RAM). The function of DDRAM is to store character that displayed on LCD screen.
HD44780 LCD controller has 128 different addresses for DDRAM, although not all addresses have their own location on LCD screen. Only 80 display locations can be used to store characters. HD44780 is a LCD controller that can be used not just for 16x2 LCD size, but also for other size such as 16x4, 20x2, or 40x2. The display location for all LCD size is also same (80 location). The different is number of location that can displayed on screen. For example, on 16x2 size is only 32 location, but other location still can be used to store character, although not displayed. To displayed that, we can shift the display right or left. This is the address location of DDRAM that displayed on LCD 16x2 size every LCD power on:
Saturday, June 20, 2015
LCD 16x2 HD44780 Tutorial 2 - Basic Commands and Displaying Text
In this post, I will explain how to send commands and characters data to LCD 16x2 HD44780. From the previous tutorial, we have finished building the circuit on the breadboard. When you power up this circuit, you will see a series of square only on line 1 of the display. This is the default pattern of an uninitialized LCD display. The LCD will always reset itself to this pattern when power is applied. If you not see this pattern, you can turn the resistor variable that controls the contrast of the LCD until see this pattern.
Saturday, June 13, 2015
LCD 16x2 HD44780 Tutorial 1 - Basic Circuit
In this tutorial, I will explain about LCD 16x2 basic operation. LCD 16x2 that I will use have a Hitachi HD44780 (or compatible) controller chip. In this tutorial I will not use any microcontroller for controlling the LCD, but just use a series of switches, because it will be useful to understand the working principle of HD44780 controller chip. When you use microcontroller to drive LCD effectively, this experiment can be a benefical step to have more knowledge about HD44780 chip rather than just use existing library.
First step of this experiment is make the circuit. I will make this circuit on a breadboard. This is the circuit that I use for this experiment.
Subscribe to:
Posts
(
Atom
)





