It is same like we display moving text on our java applications or the text that you see on news channel at the bottom moving from left to right. In this project I used a 16×2 lcd with 8051(89c51,89c52) microcontroller. 16×2 lcd is used in 8-bit mode. If you don’t know 8-bit mode than just click the link and you will have a good tutorial.
|
Scrolling lcd display first method
First i am going to scroll text using my c++ expertise with out using standard 16×2 lcd commands. Text that I am moving on the screen is my name “Usman Ali Butt”. First i place the cursor at Row 2 Coulomb 14 and display my first alphabet ‘u’ at that place. Then i move my cursor one step back at location 13 and displays two alphabets ‘us’. ‘u’ at 13 and ‘s’ at 14.Then again move the cursor one step back and now three characters are displayed ‘usm’. ‘u’ at 12 ‘s’ at 13 and ‘m’ at 14 location. The whole string is displayed on the lcd in this manner and it feels like string is moving. Actually you programmed it to do so.
Coming to the code. First include the necessary library reg51.h that is to be included in every project where you are using 8051(89c51,89c52,89s51,89s52 etc) series microcontrollers in your project. Then Port-3 pins 5 and 6 are used as rs(register set) and en(enable) pins for lcd control . If you dont know what they are you can have a good tutorial here.
Then I defined the string which i want to scroll on the lcd in the form of character array c[15]. Then some commands are defined they are actually moving the cursor one step back after each cycle.
The rest of the code is delay() function to give necessary delay where needed. lcdint() Function to initialize lcd. lcdcmd() is sending commands to lcd. Display() function is sending data to lcd for display. Dont know Commands and Data Send to Lcd. Here is a good tutorial.
Port-1 is used to send data and commands to the lcd. Port-1 is connected to Data pins of lcd.
Second Method
The more easy way is to scroll the text using standard lcd commands. The code is same like the above method. The only change is in the main function & now the text which i am going to scroll is my web site name “microcontroller-project.com”.
In the main function only the command 0x18 is performing the function of scrolling-moving. It scrolls the printed letter to wards one step left. In the main function while loop prints each letter once and then calls the 0x18 command which moves whole of the text to wards left.From whole of the text i mean the letters which are printed previously and printed in the current instruction.
Note: I am continuously scrolling the text on lcd.
Filed Under: 8051 Microcontroller, Electronic Projects
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.