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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/20/05 18:24
Read: times


 
#99742 - KeilC51 simulation error(UART)!
Hi there:

I just have written a piece of code for UART communication, but it can not work under KeilC51, I mean the simulation result is wrong!
I want to control the AT89S52 to transmit what it receives, but the DATA at SBUF can not be MOV to A, namely "MOV A, SBUF" does not work.
here is the code:
ORG 0000H
DYTA EQU 50H
AJMP START
START: MOV TMOD, #20H ;set timer1 to mode 2
MOV SCON, #01010000B ;set UART to mode 1
MOV TH1, #0FDH ;Fosc=12M, baudrate=9600
MOV TL1, #0FDH
SETB TR1

JNB RI, $
MOV A, SBUF
MOV DYTA, A
CLR RI


MOV SBUF, DYTA
JNB TI, $
CLR TI
END
Yes, this is a very simple program, but when I simulate in KeilC51, the content of "A" is always ZERO.(I have set the value of SBUF and set the bit RI! )

I don't know what the matter is!

Thanks for your help!

List of 11 messages in thread
TopicAuthorDate
KeilC51 simulation error(UART)!            01/01/70 00:00      
   SBUF incorrectly handled using Keil.            01/01/70 00:00      
      yes, the baudrate is incorrect            01/01/70 00:00      
      the program runs well on a real AT89S52            01/01/70 00:00      
         It may run, but it is still broken.            01/01/70 00:00      
            the "end"            01/01/70 00:00      
               [pre][/pre] and Quote Text option            01/01/70 00:00      
                  formatting, quoting            01/01/70 00:00      
                     Got it!            01/01/70 00:00      
   Wonderful!            01/01/70 00:00      
      who say so?            01/01/70 00:00      

Back to Subject List