Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC18F452 LCD display moving text

Status
Not open for further replies.

Hihi

New Member
Hello everyone... i have a 16x2 LCD and i am able to display text on the LCD but wanted make the text moving like having the text moving from right to left of the LCD instead of stationery text... anyone can help mi? thanks :D
 
JFDuval said:
Hello!

Code:
        if (config == shift)
        {
             //shift display
             LCDrs = 0;
             LCDdata = 0b00011000;  
             wait;
             LCDenable = 1;
             wait;
             LCDenable = 0;
             wait;
         }

Hello, can I ask is this in assembly langauage?
Because actually I don't quite understand the code. :D
 
If you have text displayed and you are using assembler, then you must understand how to send commands to the display. To scroll the display left send the command 18h (Binary 00011000) and to scroll right send 1Ch (00011100).

JFDuval is basically saying the same thing but appears to be using a basic interpreter.

HTH

Mike.
 
Pommie said:
If you have text displayed and you are using assembler, then you must understand how to send commands to the display. To scroll the display left send the command 18h (Binary 00011000) and to scroll right send 1Ch (00011100).

JFDuval is basically saying the same thing but appears to be using a basic interpreter.

HTH

Mike.

oh i see... i will go try it out.. thanks alot both of you.. :)
 
Hi again.
This is part of my code, I suppose that changes should be made here, but after trying to modify and reading through book yesterday I still can't get the text to move.
Sorry can anyone help :roll:

movlw b'00101000' ;#5 Function set
movwf temp_wr
rcall i_write

movlw b'00001100' ;#6 Display Control
movwf temp_wr
rcall i_write

movlw b'00010000' ;#7 Cursor and Shift control
movwf temp_wr
rcall i_write

movlw b'00000001' ;#8 Display Clear
movwf temp_wr
rcall i_write

movlw b'00000110' ;#9 Entry Mode
movwf temp_wr
rcall i_write

movlw b'10000000' ;DDRAM addresss 0000
movwf temp_wr
rcall i_write
 
The above code looks like the display initialisation code. After the above, you should have code that writes data to the display that is then displayed.

A couple of things to try,

1. try changing the line
movlw b'00000110' ;#9 Entry Mode

To

movlw b'00000111' ;#9 Entry Mode

2. After writing the data to the display so that it is displaying something, try putting the following.

movlw b'00011000'
movwf temp_wr
rcall i_write

Let us know how you get on.

Mike.
 
Hi..thanks first... ya i try ur method.. after i try step 1 changing the entry mode b'00000111'... the LCD did not display anthing even after i add the step 2 code nothing display too... so i try to keep the entry at b'00000110' and add in the step 2 code and it display the text but it is as the same as prevouis the text is not moving..

by the way this is my edited code following your step.. did i did it correctly?


movlw b'00101000' ;#5 Function set
movwf temp_wr
rcall i_write

movlw b'00001100' ;#6 Display Control
movwf temp_wr
rcall i_write
movlw b'00010000' ;#7 Cursor and Shift control
movwf temp_wr
rcall i_write

movlw b'00000001' ;#8 Display Clear
movwf temp_wr
rcall i_write

movlw b'00000111' ;#9 Entry Mode
movwf temp_wr
rcall i_write

movlw b'10000000' ;DDRAM addresss 0000
movwf temp_wr
rcall i_write

movlw b'00011000'
movwf temp_wr
rcall i_write
 
movlw b'00101000' ;#5 Function set
movwf temp_wr
rcall i_write

4-bit interface?

movlw b'00010000' ;#7 Cursor and Shift control
movwf temp_wr
rcall i_write

If you want the characters to scroll left, then it should be b'00011000'.
 
it is suppose to be 8-bit interface.. try it before setting it to be 8-bit but after setting it to be 8-bit no text is shown... only when i change it back to 4-bit then the text is display...

movlw b'00111000' ;#5 Function set
movwf temp_wr
rcall i_write


try the cursor and shift control but still did not work... only can have text displayed but not moving..

do i need to add in anything like delay or loop? coz read some of the website saying about this but not too sure...
 
do i need to add in anything like delay or loop? coz read some of the website saying about this but not too sure...

Yes, you sure do. Until you got the 4/8-bit function set, you have to rely on delays to make sure the LCD executes the command first before proceeding to the next.
 
hello all again... after a few day of figuring out and changing of code i found that text is still unable to move :cry: .. go through alot of book n website and information from u guys, most have common solution to problem which is :
movlw b'00010000' ;#7 Cursor and Shift control
movwf temp_wr
rcall i_write

we too believe that this shd be the way to configure it to move however it is unable to work... might it be some other part of the program preventing it from executing??

this is not my main program code but my display part code.. can anyone help mi to check where have i actually gone wrong? thks alot in advance..
 

Attachments

  • p18lcd_tx.txt
    7.1 KB · Views: 293
  • p18lcd_tx.txt
    7.1 KB · Views: 453
hello guys... anyone found out any error in my code? if there is any error please guide mi so that i can make correction to the code... :D
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top