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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/07/05 15:17
Read: times


 
#89220 - Hello World program problem.
Hello.

I'm a newby to 8051 and LCD programming(and probably English language too) here. But I'll try my best.

I've read every page of these tutorials found in this site...

-Standard 8051 Tutorial
-Introduction to LCD Programming with 8051
-A software-based Real-Time Clock (RTC)

Now I'm trying to make a Hello World program work on my simulator.

The simulator is called Isis 6 professional. I wired the 2 devices according to the sample in this page

http://www.8052.com/tutlcd.phtml

And modify some of the Hello World program code so it can be compiled. (like renaming 'DATA' to 'D', etc.)

The code look like this...

D0 EQU P1.0
D1 EQU P1.1
D2 EQU P1.2
D3 EQU P1.3
D4 EQU P1.4
D5 EQU P1.5
D6 EQU P1.6
D7 EQU P1.7
E EQU P3.7
RS EQU P3.6
RW EQU P3.5
D EQU P1

ORG 0000h
LJMP MAIN

WAIT_LCD:
SETB E ;Start LCD command
CLR RS ;It's a command
SETB RW ;It's a read command
MOV D,#0FFh ;Set all pins to FF initially
MOV A,D ;Read the return value
JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy
CLR E ;Finish the command
CLR RW ;Turn off RW for future commands
RET

INIT_LCD:
SETB E
CLR RS
MOV D,#38h
CLR E
LCALL WAIT_LCD
SETB E
CLR RS
MOV D,#0Eh
CLR E
LCALL WAIT_LCD
SETB E
CLR RS
MOV D,#06h
CLR E
LCALL WAIT_LCD
RET

CLEAR_LCD:
SETB E
CLR RS
MOV D,#01h
CLR E
LCALL WAIT_LCD
RET

WRITE_TEXT:
SETB E
SETB RS
MOV D,A
CLR E
LCALL WAIT_LCD
RET

MAIN:
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,#' '
LCALL WRITE_TEXT
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

END

The simulator shows nothing on the LDC display. I tried debugging and found that the program got stucked in infinite loops here...

WAIT_LCD:
SETB E ;Start LCD command
CLR RS ;It's a command
SETB RW ;It's a read command
MOV D,#0FFh ;Set all pins to FF initially
MOV A,D ;Read the return value
JB ACC.7,WAIT_LCD ;If bit 7 high, LCD still busy

Please let me know what I did wrong.

Thank you ^_^

List of 22 messages in thread
TopicAuthorDate
Hello World program problem.            01/01/70 00:00      
   More info            01/01/70 00:00      
      Scope ?            01/01/70 00:00      
   Suspect tutorial?            01/01/70 00:00      
      Definitely suspicious!            01/01/70 00:00      
         You are right            01/01/70 00:00      
            Craig, you are not the only one            01/01/70 00:00      
               Of course...            01/01/70 00:00      
                  been there, done that            01/01/70 00:00      
            For what it's worth (not much)            01/01/70 00:00      
      Absolutely !!!            01/01/70 00:00      
         ISIS ?            01/01/70 00:00      
            Isis manufacturer website            01/01/70 00:00      
   Here comes new(?) problem. ^_^;            01/01/70 00:00      
      Correction            01/01/70 00:00      
         Good to hear it really worked. ^_^            01/01/70 00:00      
   Be sure it solves your problem!            01/01/70 00:00      
      Re:            01/01/70 00:00      
   Its ISIS not the code            01/01/70 00:00      
      Status not supported            01/01/70 00:00      
         Polling Vs Delays            01/01/70 00:00      
            What kind of an excuse is that?!            01/01/70 00:00      

Back to Subject List