??? 01/16/05 18:13 Read: times |
#85050 - LCD & SERIAL Problem |
hey guys,
I'm supposed to create a device which writes caracter on an LCD. The caracters come in trough serial. I 'stole' the complete LCD routine from the tutorials when I attach the board without the LCD the controller echo's the text back to the PC as supposed. If I connect the LCD all of my serial echo is lost and on the LCD the first two caraters show a fast flashing cursor. Does anyone have any idea why this happens? I think the software gets stuck somewhere in teh LCD delay but since it came from the tutorials I don't know what went wrong Hope someone has any idea Thanx jeroen PS normally the LCD routines are packed in a .H file and add with #include LCD.H just like 8051.H ; serial communication ;set serial receive for 19200/8/n/1 #include 8051.H .org 0000H ajmp Main ; LCD Routine DATA .equ 080H ;P0 DB0 .equ 080H ;P0.0 DB1 .equ 081H ;P0.1 DB2 .equ 082H ;P0.2 DB3 .equ 083H ;P0.3 DB4 .equ 084H ;P0.4 DB5 .equ 085H ;P0.5 DB6 .equ 086H ;P0.6 DB7 .equ 087H ;P0.7 RS .equ 0A2H ;P2.2 RW .equ 0A1H ;P2.1 EN .equ 0A0H ;P2.0 INIT_LCD mov R0, #00H SETB EN CLR RS MOV DATA,#38h CLR EN LCALL WAIT_LCD SETB EN CLR RS MOV DATA,#0Eh CLR EN LCALL WAIT_LCD SETB EN CLR RS MOV DATA,#06h CLR EN LCALL WAIT_LCD WRITE_LCD SETB EN SETB RS MOV DATA,A CLR EN LCALL WAIT_LCD RET CLEAR_LCD SETB EN CLR RS MOV DATA,#01h CLR EN LCALL WAIT_LCD RET WAIT_LCD: SETB EN ;Start LCD command CLR RS ;It's a command SETB RW ;It's a read command MOV DATA,#0FFh ;Set all pins to FF initially MOV A,DATA ;Read the return value JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy CLR EN ;Finish the command CLR RW ;Turn off RW for future commands RET .org 0100H Main acall Init ; initialise run acall REC ; call RECeive acall SND sjmp run .end Init acall INIT_LCD mov TMOD, #20h ; Timer 1 in Auto-reload mode mov IE, #00h ; reset intterupts mov PCON, #80h ; set SMOD for 19200 baud mov SCON, #50h ; serial mode 1, REN=1 mov TH1, #253 ; load T1 for 19200 baud setb TR1 ; start timer ret ; return REC jnb RI, $ ; Wait for the 8051 to set the RI flag mov A, SBUF ; Read the character from the serial port clr RI ; set for next character ret ; return SEND clr TI ; Be sure the bit is initially clear mov SBUF, A ; send character jnb TI, $ ; Pause until the TI bit is set. ret ; return SND acall SEND acall WRITE_LCD ret |
Topic | Author | Date |
LCD & SERIAL Problem | 01/01/70 00:00 | |
Missing RET | 01/01/70 00:00 | |
More probs | 01/01/70 00:00 | |
Xtra Info | 01/01/70 00:00 | |
Testing? | 01/01/70 00:00 | |
Obvious, but necessary question. | 01/01/70 00:00 | |
too much conflict![]() | 01/01/70 00:00 |