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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/27/02 20:34
Read: times


 
#28011 - RE: Serial Program for 89C51 not responding
DB COUNTER

THVAL EQU 0FDH

ORG 0000H
         AJMP 0100H
ORG 0023H
         JBC TI,TMT
         RETI
TMT:
         DJNZ COUNTER,NEXT
         CLR TR1
         AJMP R
NEXT:    INC DPTR
         MOVX A,@DPTR
         MOV SBUF,A
R:       RET

ORG 0100H
         MOV COUNTER,#20H
         MOV SP,#50H
         MOV DPTR,#STR
         
         MOV SCON,#74H
         MOV PCON,#00H
         MOV IE,#98H
         MOV IP,#18H
         MOV TCON,#00H
         MOV TMOD,#20H
         MOV TH1,#THVAL
         MOV TL1,#THVAL
         
         SETB SCON.6
         MOVX A,@DPTR
         MOV SBUF,A
        
STR:     DB 'WELCOME TO 8052.COM AND MY PAGE.',0

         END

Here are a few, but not necessarily all, bugs I see at first glance:

"MOV TCON,#00H" has Timer1 stopped, so it can't generate the serial bit clock.

"CLR TR1" in the ISR stops the serial baud clock if it were to get started.

The "RET" at label "R:" should be "RETI".

After "MOV SBUF,A", you have nothing to prevent the string at "STR" from being executed as program instructions.

The string appears to be located in program memory, so your MOVX's should be MOVC's.


List of 13 messages in thread
TopicAuthorDate
Serial Program for 89C51 not responding            01/01/70 00:00      
RE: Serial Program for 89C51 not responding            01/01/70 00:00      
RE: Serial Program for 89C51 not responding            01/01/70 00:00      
Are\\\'nt they correct??            01/01/70 00:00      
89C51 in Normal Mode??            01/01/70 00:00      
RE: Addendum to Dan\'s message            01/01/70 00:00      
RE: Addendum to Dan\\\'s message            01/01/70 00:00      
RE: Addendum to Dan\\\\\\\'s message            01/01/70 00:00      
Addendum to my message ;-)            01/01/70 00:00      
RE: Are\\\\\\\'nt they correct??            01/01/70 00:00      
RE: Addendum to my message ;-)            01/01/70 00:00      
RE: Addendum to my message ;-)            01/01/70 00:00      
RE: Addendum to my message ;-)            01/01/70 00:00      

Back to Subject List