Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/08/09 02:26
Read: times


 
#168789 - hd44780 16x2 lcd some letters display as other letters
I have no idea what is causing it but for some reason some letters like e for example shows on the lcd as the letter d ,
Im using the built in character gen , could it be a dud? or is it more then likely something wrong with my program?.

...
$MOD52


;;;;;;ports for lcd ;;;;;;;
		EN EQU P1.2 
		RS EQU P1.0 
		RW EQU P1.1 
		LCD_DATA EQU P0
     
; Program start

; start timer 1 and then start serial rx in mode 1
start:
    LCALL INIT_LCD
    LCALL CLEAR_LCD
    mov  dptr,#0
    mov  dptr,#WelcomeText
    lcall loop
    sjmp stop

Loop:
   clr  a
   movc a,@a+dptr
   inc  dptr
   jz    WriteStringEnd
   call WRITE_TEXT
   sjmp loop
WriteStringEnd:
   ret
stop: sjmp stop
;;;;;;;lcd routines ;;;;;; 

WAIT_LCD:


		MOV		R1,#1H		; 
SEC_LOOP:
		MOV		TH0,#00H	; CLEAR TIMER 0
		MOV		TL0,#00H
		CLR		TF0			; CLEAR OVERFLOW BIT
		SETB	TR0			; START TIMER 0
		JNB		TF0,$		; WAIT FOR OVERFLOW FLAG
		CLR		TR0			; STOP TIMER 0
		
		
		
		DJNZ	R1,SEC_LOOP


RET

      

WAIT_LCD2:


		MOV		R1,#16H		; 
SEC_LOOP2:
		MOV		TH0,#00H	; CLEAR TIMER 0
		MOV		TL0,#00H
		CLR		TF0			; CLEAR OVERFLOW BIT
		SETB	TR0			; START TIMER 0
		JNB		TF0,$		; WAIT FOR OVERFLOW FLAG
		CLR		TR0			; STOP TIMER 0
		
		
		
		DJNZ	R1,SEC_LOOP2

       RET

INIT_LCD:
       LCALL WAIT_LCD2
       CLR RS
       CLR RW
       MOV LCD_DATA,#38h
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       CLR RS
       CLR RW
       MOV LCD_DATA,#0Eh
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       CLR RS
       CLR RW
       MOV LCD_DATA,#06h
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       RET


CLEAR_LCD:

       CLR RS
       CLR RW
       MOV LCD_DATA,#01h
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       RET
				
WRITE_TEXT:

       SETB RS
       MOV LCD_DATA,A
       SETB EN
       CLR EN
       LCALL WAIT_LCD
       RET
				
WelcomeText:
db 'abcdefghijklmnopqrstuvwxyz',0	
		




endloop:
       jmp endloop


END 
 



List of 12 messages in thread
TopicAuthorDate
hd44780 16x2 lcd some letters display as other letters            01/01/70 00:00      
   How fast is your 8051?            01/01/70 00:00      
      speed            01/01/70 00:00      
         incomplete init, or some hardware issue            01/01/70 00:00      
            Looks like short between D0 and GND            01/01/70 00:00      
               Pullup on D0 P0            01/01/70 00:00      
               Debug Tip: Always look for patterns!            01/01/70 00:00      
                  Oscilloscope            01/01/70 00:00      
               will check D0            01/01/70 00:00      
                  It could simply be open ...            01/01/70 00:00      
                     the analysis is fine...            01/01/70 00:00      
                        It's easier if he has one ...            01/01/70 00:00      

Back to Subject List