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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/16/09 15:21
Read: times


 
#163497 - JHD162a wid at89c52......conceptual problem...PLz Help!
Hi Guyz,

M new to dis microcontroller practicals, though i ve done quite a reasonable theory bt never tested anything practically.....
This is my first circuit....n it is like.....I wanna display 'Hello' on LCD module JHD162A using a 8 bit interfacing with 89c52....My code is as simple as it cud b....connections are also proper.....chip is also working......but after switching on the supply what i am getting is a series of black boxes in the 1st line......
I m attaching my code.......so plz if anyone cud figure out what mistake m commiting or what is d reason of black boxes den i vl b heartily thankful........m struggling from last 4 days ......Plz Help!!!
Connections are as follows:
RS -> p2.1 ; EN -> p2.2 ; R/W -> p2.3 ; DB0 - DB7 -> Port1 ; 1st,3rd and 16th Pin are shorted n connected to 20th (GND) pin of 89c52........and 2nd and 15th are shorted and connected to 40th(Vcc) pin of 89c52.
And Vcc is around 6.2 Volts (old power supply.....is dis z the problem?).

org 0000h
LCALL INIT_LCD
LCALL CLEAR_LCD
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,#' '

WRITE_TEXT:	SETB p2.1 ; RS = p2.1
MOV p1,A
SETB p2.2                 ; EN = p2.2
CLR p2.2
LCALL WAIT_LCD
RET

CLEAR_LCD:	CLR p2.1
MOV p1,#01h
SETB p2.2
CLR p2.2
LCALL WAIT_LCD
RET

INIT_LCD:		CLR p2.1
MOV p1,#38h
SETB p2.2
CLR p2.2
LCALL WAIT_LCD
CLR p2.1
MOV p1,#0Eh
SETB p2.2
CLR p2.2
LCALL WAIT_LCD
CLR p2.1
MOV p1,#06h
SETB p2.2
CLR p2.2
LCALL WAIT_LCD
RET

WAIT_LCD:	CLR EN ;Start LCD command
CLR p2.1 ;It's a command
SETB p2.3 ;It's a read command, R/w = p2.3
MOV p1,#0FFh ;Set all pins to FF initially
SETB p2.2 ;Clock out command to LCD
MOV A,p1 ;Read the return value
JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy
CLR p2.2 ;Finish the command
CLR p2.3 ;Turn off RW for future commands
RET

 




List of 9 messages in thread
TopicAuthorDate
JHD162a wid at89c52......conceptual problem...PLz Help!            01/01/70 00:00      
   Some thoughts...            01/01/70 00:00      
   see this            01/01/70 00:00      
      Comments?            01/01/70 00:00      
      Code????            01/01/70 00:00      
         contrary...            01/01/70 00:00      
   Why you should comment your code            01/01/70 00:00      
   Introduce Delay            01/01/70 00:00      
      speaking of delay ...            01/01/70 00:00      

Back to Subject List