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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/04/07 14:29
Read: times


 
#131973 - Code for 8-Bit LCD (HD44780)
Responding to: ???'s previous message
This is the Code which worked for me, and also there is the pin configuration of My MCu (AT89C2051) with the LCD, Hoping that it will help the Noob Programmers (just like me) ;-)


VSS ----> GROUND (PIN-NO 1 ON LCD)
VCC ----> +5V (PIN-NO 2 ON LCD)
CONTRAST-> 10KPOT (PIN-NO 3 ON LCD) [ONE SIDE GROUND ONE SIDE +5V]
P3.4 ----> RS (PIN-NO 4 ON LCD)
P3.5 ----> RW (PIN-NO 5 ON LCD)
P3.7 ----> EN (PIN-NO 6 ON LCD)
P1.0 ----> DB0 (PIN-NO 7 ON LCD)
P1.1 ----> DB1 (PIN-NO 8 ON LCD)
P1.2 ----> DB2 (PIN-NO 9 ON LCD)
P1.3 ----> DB3 (PIN-NO 10 ON LCD)
P1.4 ----> DB4 (PIN-NO 11 ON LCD)
P1.5 ----> DB5 (PIN-NO 12 ON LCD)
P1.6 ----> DB6 (PIN-NO 13 ON LCD)
P1.7 ----> DB7 (PIN-NO 14 ON LCD)


CODE FOR 8-BIT HD44780 LCD FOR WRITING "DARE DEVIL" ON LCD

                ORG 0000H
                LJMP MAIN
                ORG 0030H
		RS EQU P3.5
		RW EQU P3.4
		EN EQU P3.7
                                    	;initialization
MAIN:           MOV A,#038H     	;8 bit mode ON, 2 lines, 5*8 font
		LCALL COM		;first time
                MOV A,#038H             ;second time
                LCALL COM
                MOV A,#038H             ;third time
                LCALL COM
                MOV A,#038H             ;fourth time
                LCALL COM
                MOV A,#00CH		;display ON, cursor OFF, blink OFF
                LCALL COM
                MOV A,#001H		;clear screen
                LCALL COM
                MOV A,#006H		;increase cursor position, scroll display OFF
                LCALL COM
                MOV A,#080H		;Set DDRAM address to 0 (means to starting)
                LCALL COM       	;initialization End
                MOV A,#'D'     		;data to write on LCD
                LCALL DATAW
                MOV A,#'A'
                LCALL DATAW
                MOV A,#'R'     		
                LCALL DATAW
		MOV A,#'E'
                LCALL DATAW
		MOV A,#' '     		
                LCALL DATAW
		MOV A,#'D'
                LCALL DATAW
		MOV A,#'E'
                LCALL DATAW
		MOV A,#'V'
                LCALL DATAW
		MOV A,#'I'
                LCALL DATAW
		MOV A,#'L'
                LCALL DATAW		;data end
AGAIN:          SJMP AGAIN    		;endless loop
COM:            MOV P1,A   		;command write sequence
                CLR RS
                CLR RW
                SETB EN
		;LCALL TEST
		CLR EN
		LCALL DELAY
                RET
DATAW:          MOV P1,A   		;data write sequence
                SETB RS
                CLR RW
                SETB EN
                ;LCALL TEST
		CLR EN
		LCALL DELAY
                RET
DELAY:          MOV R6,#50    		;simple delay routine
HERE2:          MOV R7,#255  		;for 0.0124S or 124MS
HERE:           DJNZ R7,HERE
                DJNZ R6,HERE2
                RET
TEST:		JB P3.0,TEST
TEST2:		JNB P3.0,TEST2
		RET
                END




List of 70 messages in thread
TopicAuthorDate
LCD Help needed            01/01/70 00:00      
   as replied in parallel thread            01/01/70 00:00      
   try this...            01/01/70 00:00      
      Not this bit            01/01/70 00:00      
         I do both software and hardware.            01/01/70 00:00      
            diffference            01/01/70 00:00      
   What assembler??            01/01/70 00:00      
   No Initializatoin            01/01/70 00:00      
      Wait There it is.            01/01/70 00:00      
   Ah lcd problems!            01/01/70 00:00      
   Hardware problem?            01/01/70 00:00      
      Well i think its the Hardware + Software problem            01/01/70 00:00      
         Half of display            01/01/70 00:00      
            8 bit initialization            01/01/70 00:00      
               This is New Program            01/01/70 00:00      
                  nothing new            01/01/70 00:00      
                     Well sir Erik there is my code commented            01/01/70 00:00      
                        sparsely and nit using <pre> and </pre>            01/01/70 00:00      
                           It's not that difficult            01/01/70 00:00      
                              Well its not being good            01/01/70 00:00      
                                 OK, down to brass tacks and babysteps            01/01/70 00:00      
            Right Sid of LCD is Fading            01/01/70 00:00      
         normal?            01/01/70 00:00      
      LCD's vary, and contrast voltage is NEGATIVE!            01/01/70 00:00      
         sometimes            01/01/70 00:00      
            I heard that once ...            01/01/70 00:00      
         HUH?            01/01/70 00:00      
            guilty as charged            01/01/70 00:00      
               two            01/01/70 00:00      
                  I reuse mine            01/01/70 00:00      
   try this one            01/01/70 00:00      
      why try something that can not be unbderstood            01/01/70 00:00      
   Solve            01/01/70 00:00      
      Nothing is happining with New LCD also            01/01/70 00:00      
         Sorry guys...            01/01/70 00:00      
         Try            01/01/70 00:00      
            Well sir I am using HD44780            01/01/70 00:00      
               sloooow down coders            01/01/70 00:00      
   TESTED code for LCD            01/01/70 00:00      
      It may be tested..            01/01/70 00:00      
         blame            01/01/70 00:00      
            Circuit configuration for LCD interfacing            01/01/70 00:00      
               P1.x control?            01/01/70 00:00      
                  No problem with pin configuration            01/01/70 00:00      
                     Well i have changed Pin configuration back            01/01/70 00:00      
                        Pullups on P1.0,1            01/01/70 00:00      
                           about P1.0 and P1.1            01/01/70 00:00      
                        Does your micro work at all?            01/01/70 00:00      
                           to be specific...            01/01/70 00:00      
                        my issue            01/01/70 00:00      
      debugging            01/01/70 00:00      
   Finally i have did it.....            01/01/70 00:00      
      go high            01/01/70 00:00      
   Code for 8-Bit LCD (HD44780)            01/01/70 00:00      
      perfect            01/01/70 00:00      
         Perfect for some...            01/01/70 00:00      
            it is important with the at89c2051            01/01/70 00:00      
               i am noob, so dont worry about pins :-)            01/01/70 00:00      
                  no encryption required            01/01/70 00:00      
               Real world            01/01/70 00:00      
                  answer            01/01/70 00:00      
                     Is this true?            01/01/70 00:00      
                        To some people it seems            01/01/70 00:00      
                           kindof            01/01/70 00:00      
                              You can get by with this some of the time            01/01/70 00:00      
                              Point missed            01/01/70 00:00      
                                 check this            01/01/70 00:00      
                                    You didn't take the challenge            01/01/70 00:00      
   why should you            01/01/70 00:00      
   Help on LCD code            01/01/70 00:00      

Back to Subject List