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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/21/06 17:44
Read: times


 
#128371 - posting the code here
Responding to: ???'s previous message
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
EN EQU  P0.2
RS EQU  P0.0
RW EQU  P0.1
DATA1 EQU P1

org 0000h
    
        LCALL DELAY_LCD

	LCALL INIT_LCD 		;  LCD INTIALIZATION
	LCALL CLEAR_LCD 	;  CLEARING LCD DISPLAY


	MOV   A,#'H'
	LCALL WRITE_TEXT
	MOV   A,#'E'
	LCALL WRITE_TEXT
	MOV   A,#'L'
	LCALL WRITE_TEXT
	MOV   A,#'L'
	LCALL WRITE_TEXT
	MOV   A,#'O'
	LCALL WRITE_TEXT
	MOV   A,#' '
	LCALL WRITE_TEXT
	
	CLR RS
	MOV DATA1,#0C1H
	SETB EN
        NOP
        NOP
	NOP
	CLR EN
	LCALL WAIT_LCD
	
	MOV    A,#'W'
	LCALL  WRITE_TEXT
	MOV    A,#'O'
	LCALL  WRITE_TEXT
	MOV    A,#'R'
	LCALL  WRITE_TEXT
	MOV    A,#'L'
	LCALL  WRITE_TEXT
        MOV    A,#'D'
	LCALL  WRITE_TEXT
         
        CLR  P0.7                ;to isplay successful execution 

HERE:   SJMP HERE


WAIT_LCD:

      CLR   EN 		           
      CLR   RS 	                  ;It's a command
      SETB  RW                    ;It's a read command
      MOV   DATA1,#0FFh           ;Set all pins to FF initially
      SETB  EN 		          ;Clock out command to LCD
      MOV   A,DATA1 	          ;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



INIT_LCD:

      CLR RS	        	;CLEARING RS SINCE COMMAND
      MOV DATA1,#3Ch 	        ;CONTOL WORD TO SAY 2X8 LCD
      SETB EN			
      NOP			;DELAY FOR ENABLE
      NOP
      NOP
      CLR EN
      LCALL WAIT_LCD	        ;WAITING FOR THE END OF COMMAND

      CLR RS			; SECOND CONTROL WORD 
      MOV DATA1,#0Ch	        ;  TO TURN ON LCD AND CURSOR
      SETB EN			; CLOCK FOR LCD
      NOP
      NOP
      NOP
      CLR EN
      LCALL WAIT_LCD       ; WAITING FOR THE EXECUTION OF COMMAND
      
      LCALL CLEAR_LCD
 
      CLR RS
      MOV DATA1,#06h 	   ; TO MOVE THE CURSOR TO THE RIGHT
      SETB EN
      NOP
      NOP
      NOP
      CLR EN
      LCALL WAIT_LCD
       
 
  RET


CLEAR_LCD:

      CLR RS  
      MOV DATA1,#01h 		; COMMAND TO CLEAR LCD 
      SETB EN
      NOP
      NOP
      NOP
      CLR EN
      LCALL WAIT_LCD
  RET

WRITE_TEXT:

      SETB RS
      MOV DATA1,A 		; DATA IN A MOVED TO THE PORT
      SETB EN
      NOP
      NOP
      NOP
      CLR EN
      LCALL WAIT_LCD
  RET

DELAY_LCD:
       
      NOP
      NOP 
      NOP
      NOP
      NOP
      NOP
  RET
  END

i have posted the code here .i dont understand what is the mistake i make .please suggest me the modifications i should make

List of 15 messages in thread
TopicAuthorDate
problem with second row of lcd            01/01/70 00:00      
   How does the LCD interface?            01/01/70 00:00      
      the port connections            01/01/70 00:00      
         berth strip?            01/01/70 00:00      
   Address            01/01/70 00:00      
      to Himanshu Thakkar            01/01/70 00:00      
         What display?            01/01/70 00:00      
   Maybe forget to pullup P0!            01/01/70 00:00      
      problem with addressing for sure            01/01/70 00:00      
         to Gagandeep Singh            01/01/70 00:00      
            initialisation string ?            01/01/70 00:00      
               posting the code here            01/01/70 00:00      
                  Initialization            01/01/70 00:00      
                  Busy Flag            01/01/70 00:00      
            If you can't see the blocks on the 2nd line            01/01/70 00:00      

Back to Subject List