Scrolling/Moving text on lcd with pic microcontroller – Project requirements
- Pic 16f877 microcontroller
- 16×2 lcd (I am using.)
- Potentiometer/variable resistor (To set lcd contrast)
- crystal(20 MHz)
- Power supply
If you are newbie and don’t know much about 16×2 lcd working and pin out just go through this simple tutorial. It will explain you about all the pins and functions of 16×2 lcd.
16×2 lcd pinout and working.
Pic microcontroller scrolling text – Project circuit
Pic microcontroller moving text on lcd – Project code
After the header files now its time to define our functions. First i defined delay function which is used to generate some delay in program execution.Next comes lcd command function.
lcdcmd() function is sending commands to 16×2 lcd. For sending commands first put your command on port-b then select register(to select command register make rs=0). After selecting the command register select which operation you want to perform read or write(for read make rw=1 and write make rw=0). Finally to display character on 16×2 lcd screen give strobe to write command present on data pins of 16×2 lcd. Just make en high(en=1) and after few micro seconds bring it back to low (en=0).
display() functions works in the same way as lcdcmd but with little difference that except command it is writing data on lcd and you just need to select the data register to write data(rs=1 takes you to lcd data register).
lcdint() function is initializing our lcd and pic microcontroller ports. TRISB=0x00 declares pic microcontroller port-b as output port. TRISD5=0,TRISD6=0 & TRISD7=0 are making individual pins of port-d as output. Rest of the commands are initializing our 16×2 lcd. If you want to know about the functions of the commands just go through the tutorial(Link is given at the top after first paragraph).
In the main function i am displaying text on 16×2 lcd. I start displaying text from first coulomb of row 1 and when my text reaches at the end of the row 1 i start scrolling the text to the left.The statement if(i>=14){lcdcmd(0x18);} is performing this function. When my text reaches to last coulomb of 16×2 lcd which is 15 i start scrolling it to left. The command/statement lcdcmd(0x18) scrolls the text on 16×2 lcd using pic microcontroller.
I recommend you to please go through the tutorial 16×2 lcd pinout and working if you don’t understand commands and their working.
Watch the Project video Here…..
Moving Scrolling Text on lcd using Pic18f452 Microcontroller
In simulation both pic microcontroller codes hex files are given. You can verify both the codes working accurately according to our requirements by running simulation on both the codes hex files separately.
Filed Under: Microcontroller 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.