In this project i am going to display urdu language characters on 16×2 lcd using pic16f877 microcontroller. Urdu is a language spoken in Pakistan, India and Bangladesh. Character lcd’s generally contains a Hitachi HD4478 controller in it. Hd4478 only contains ASCII character set in it and we can only display the predefined characters that are present in it. It contains numeric, English and Chinese language characters in it.
So to display urdu characters we must know about how to make custom characters and display it on character 16×2 lcd. Displaying self made custom characters on lcd requires knowledge about internal structure of lcd. To display custom characters like urdu you should know about lcd CG-RAM,data & command registers.
A good and perfect tutorial to understand the internal structure of lcd CG(character generated) ram is given below. Since its very important and lengthy topic so it is not possible to explain it here. I recommend you to please take the below tutorial other wise you will be unable to understand the project code below.
Project Requirements
|
Coming to the code portion. The code is written in c language using MP-lab ide. High tech c compiler is used to compile the code. Header file htc.h is imported first. This file is must to be included in every project that is using high tech c compiler for compiling the code. Then crystal frequency is defined which is 20 MHz(20e6=20^6). Lcd control pins are defined next. Then the delay() function is defined which is generating some arbitrary delay for us. lcdcmd() function is sending commands to command register of lcd. dispaly() function is sending data to data register of lcd. If you dont know about lcd data and command register and their working here is a good tutorial.
Lcdint() function is initializing our lcd. The tutorial given a line above also covers the lcd intialization phase and intializing commands. In the main fuction i am generating urdu alphabets in CG-RAM and then they are diaplayed on 16×2 lcd. First i give command lcdcmd(0x40) to lcd. This 0x40 is the starting address of CG-RAM. Then the individual dots of urdu first character “i” is send to lcd. Next 0x48 is send to lcd. Which is the second address of CG-RAM character. Second character dots are then send to CG-RAM of lcd. This process repeats for the eight characters. Then all the eight custom generated characters are invoked for displaying on lcd by just giving their address(0 to 8).
After displaying first eight urdu characters next eight are build in CG-RAM and then displayed on lcd. This process repeats until the last character is displayed. After last character the lcd starts from beginning and starts displaying urdu characters from beginning.
Note: Lcd first line continuously display “Urdu Characters!” and the urdu characters are displayed on the second line. Each urdu character is displayed on lcd with one matrix gap from other. Since 16×2 lcd has 16 coulombs so 8 characters with one matrix sepration from others are perfectly displayed on the lcd second line.
Filed Under: Electronic Projects, PIC Microcontroller
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.