![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
Dear,
I now doing some animation (moving text/scrolling text) in the LCD 2x16. How to do that? Any example code? I can't find any. I just want to do a simple moving the text from left to right and continuously moving. Please help. Last edited by Paris Heng; 2nd May 2008 at 10:48 AM. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Its like this; movlw 0x1C;move all 1 right call lcd_cmd movlw 0x18; move all 1 left call lcd_cmd Do you follow.? EDIT: which PIC are you using and how do you have it connected.?
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ Last edited by ericgibbs; 2nd May 2008 at 11:15 AM. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
Thank your reply again. Last edited by Paris Heng; 2nd May 2008 at 11:37 AM. |
||
|
|
|
|
|
(permalink) |
|
Those are control codes for the LCD - basically most LCD's are really 2x40 in size, with the actual display a 'window' on to that screen buffer. Those control codes scroll the window along the buffer.
|
|
|
|
|
|
|
(permalink) |
|
hi.
As Nigel points out these are control codes for the LCD. You must have initialised the LCD anyway in 'C' in order to display text.? So, use the same LCD command instruction call that you used to initialise the LCD, except insert the 1CHand 18H to do SHIFTs. If you dont follow, post the initialise code section from your 'C' program and we will try to help...
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) | |||
|
Quote:
lcd.c Quote:
Quote:
Please assist with some basic C code. Last edited by Paris Heng; 2nd May 2008 at 12:29 PM. |
||||
|
|
|
|
|
(permalink) |
|
hi,
I am not a 'C' programmer, but this section looks like the init code for the LCD void LCD_INI(void) { wrt_cmd(0X38); wrt_cmd(0X0C); wrt_cmd(0X01); wrt_cmd(0X06); } Write your message to the LCD, so that its visible then try something like {wrt_cmd(0x1C)} for Right SHIFT Perhaps a member who uses 'C' will give more help.
__________________
Eric "Good enough is Perfect" PIC tutorials: Gramo's: www.digital-diy.net/ Bill's: www.blueroomelectronics.com/ |
|
|
|
|
|
|
(permalink) | |
|
Quote:
|
||
|
|
|
|
|
(permalink) |
|
Eric is correct, you need to write command 0x18 to scroll left and 0x1c to scroll right.
This will scroll the display around once. Code:
for(i=0;i<40;i++){
wrt_cmd(0x18);
DelaymS(100);
}
|
|
|
|
|
|
|
(permalink) |
|
May be this code helps you...there may be much room for improvement of this code but i am not very much concerned with it...my main concern is the i want it improved in this regard that it should keep on scrolling the text of any lenght without breaks whereas below given code does not do it for me...
thanx in advance. ;---------------------------------------------------------------------- ;---------------------------------------------------------------------- DB0 EQU P1.0 DB1 EQU P1.1 DB2 EQU P1.2 DB3 EQU P1.3 DB4 EQU P1.4 DB5 EQU P1.5 DB6 EQU P1.6 DB7 EQU P1.7 RS EQU P3.3 RW EQU P3.4 EN EQU P3.5 ORG 300H DB "THIS CODE IS WRITTEN BY MEHMOOD AHMED FOR 8051" DB "MICROCONTROLLER",0 ORG 00H START: ACALL INITLCD MOV A,#0H MOV DPTR,#0300H MAIN: ACALL COMMANDDELAY CLR EN PUSH ACC CJNE A,#170,ISLESS CALL SCROLLDELAY MOV A,#0H ISLESS: JZ HERE MOV B,#40 DIV AB MOV A,B JNZ HERE MOV A,#02H ACALL COMMAND HERE: POP ACC PUSH ACC MOVC A,@A+DPTR ACALL WRITECOMMAND POP ACC INC A LJMP MAIN COMMAND: CLR RS CLR RW MOV P1,A SETB EN ACALL COMMANDDELAY CLR EN RET WRITECOMMAND: ACALL SCROLLDELAY ACALL SCROLLDELAY SETB RS CLR RW MOV P1,A SETB EN ACALL COMMANDDELAY CLR EN RET INITLCD: MOV A,#30H ACALL COMMAND MOV A,#30H ACALL COMMAND MOV A,#30H ACALL COMMAND MOV A,#07H ACALL COMMAND MOV A,#0cH ACALL COMMAND ;MOV A,#010h ;ACALL COMMAND RET COMMANDDELAY: MOV R1,#20H LOOP2: MOV R0,#20H LOOP1: DJNZ R0,LOOP1 DJNZ R1,LOOP2 RET SCROLLDELAY: MOV R3,#2H LOOPX3: MOV R2,#90H LOOPX2: MOV R1,#90H LOOPX1: DJNZ R1,LOOPX1 DJNZ R2,LOOPX2 DJNZ R3,LOOPX3 RET LCDWAIT: PUSH ACC CLR A WAIT: CLR RS SETB WR SETB EN MOV P1,#0FFH MOV A,P1 CLR EN JB ACC.7,WAIT POP ACC RET END |
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Bunch of questions regarding PIC, PCB fabrication, LCD interfacing and PIC-C | xieliwei | Electronic Projects Design/Ideas/Reviews | 9 | 3rd May 2008 09:12 AM |
| LCD 2x16 Demo for the Unicorn (18F4550) | blueroomelectronics | Micro Controllers | 20 | 11th April 2008 08:08 PM |
| LCD Bargraph (fuel gauge) | karenhornby | Micro Controllers | 10 | 10th April 2008 05:19 PM |
| Atmel, assembly:displaying on lcd | Haidy | Micro Controllers | 13 | 11th February 2008 08:12 PM |
| PIC16F628A LCD problems. | HerbertMunch | Micro Controllers | 17 | 2nd October 2007 09:19 AM |