LCD modules are commonly used in most embedded projects because they are cheap, available, and programmer-friendly. Alphanumeric Graphical LCD (2004A) is a 20×4 Blue Coloured Liquid Crystal Display. It can display 4 lines of text and each line can have up to 20 characters in it, which is bigger than the 16×2 LCD but the programming is almost the same.
LCD 2004A Module
Each character has 40 Pixels and for 80 Characters we will have 3200 Pixels. Further, the LCD should also be instructed about the Position of the Pixels. It is a hectic task for the microcontroller, hence Driver IC like ST7066 is used, which is mounted on the backside of the LCD Module. It takes data from the microcontroller and processes them to display on the LCD Screen. You can use it in 8 bit parallel interface or 4 bit parallel interface mode if you need to connect fewer lines to the microcontroller.
Circuit Diagram
LCD 2004A is composed of 8 data lines. We use only 4 in our example. Connect VDD and VSS of LCD module to +5V and GND pin respectively of ARIES v2 board. Register Select pin(RS) and Enable pin (EN) is connected to GPIO3 and GPIO5 pins respectively of ARIES v2 board. Read/Write pin of LCD module can be either connected to GPIO4 of ARIES v2 board or shorted GND.
Connecting a preset/potentiometer with the Contrast Setting pin of LCD module will help us modulate the contrast of the display.
As we said earlier, here we use 4-bit data transmission, so only 4 data lines are connected.
Now, for powering up the ARIES v2 board via USB port of a Laptop/Desktop/PC and burning the code into the ARIES v2 board, we have to use a micro USB type B to USB type A cable. The cable should be connected to UART0 port of the ARIES v2 board, and the Laptop/Desktop/PC should be preinstalled with VEGA SDK and Toolchain.
LCD 2004A | ARIES v2 Board |
VDD | 5V |
VSS | GND |
RS | GPIO3 |
RW | GPIO4 |
ENABLE | GPIO5 |
DB4 | GPIO6 |
DB5 | GPIO7 |
DB6 | GPIO8 |
DB7 | GPIO9 |
Procedure
After setting up the toolchain and SDK path environments, build the example program for the LCD 2004A module by:
cd vega-sdk/examples/gpio/lcd_2004a_demo
make clean command to clean the executable :
make clean
then use make command to build it.
make
Now, we can transfer the built program to the board, before transfer please ensure that you have connected the UART0 connector of the board to the PC.
Open a new terminal and execute the following command.
sudo minicom aries
Now you can see the minicom terminal opened and the board UART terminal is ready.
Use CTRL+A S to enter file sending menu and select xmodem by pressing Enter.
In the next window, with the Space bar select the lcd_2004a_demo.bin file to be transferred, by pressing Enter, the transfer process starts.
Wait until the process is completed. The screen should display how much data has been transferred.
After completing transfer the Program will start to execute.
The output is displayed in minicom UART terminal:
For additional information :
https://www.vishay.com/docs/37314/lcd020n004l.pdf