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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/11/05 13:36
Read: times


 
#89450 - About Serial Communication!!!!!Help
Remark: the MCU is P89C51RD2, which is 6 clock per machine cycle
I want to write program in 89C51 for sending data to a PC by using serial communication
Timer 0 for counting something, Timer 1 for serial commuication, when i set the th1/tl1 to 0fah (6 clock per machine cycle, so use 0fah), and pcon to 0, the system using 9600 baud rate, and it can send correct data to the PC, but when i change th1/tl1 to 0fdh to double the baud rate, the system using 19200, but the data received in PC is totally wrong, does anybody guess what may be the problem, thanks

My code:

mov psw,#00h

mov tmod,#00100110b ;counter0 mode2
mov th0,#(256-COUNT)
mov tl0,#(256-COUNT)

mov th1,#0fah ;baud rate (fd=19200,fa=9600)
mov tl1,#0fah ;TH1=TL1 = 256 - (freq / (32 * 12 * BAUD))

mov pcon,#00h

mov scon,#50h ;8-bit UART mode1 (Serial Mode 1 Set by Timer 1)

setb tr1 ;run timer1
setb es
clr tf0 ;clear interrupt flat
setb tr0 ;enable timer0
setb et0 ;enable timer0 interrupt


List of 24 messages in thread
TopicAuthorDate
About Serial Communication!!!!!Help            01/01/70 00:00      
   insufficient            01/01/70 00:00      
      Sorry, the crystal is 11.0592MHz            01/01/70 00:00      
   It's a miracle            01/01/70 00:00      
      amazing            01/01/70 00:00      
         Sorry, since the program is very large..            01/01/70 00:00      
            Large program            01/01/70 00:00      
            Result            01/01/70 00:00      
               do you believe            01/01/70 00:00      
                  MAX232C            01/01/70 00:00      
               19200???            01/01/70 00:00      
                  PCON vs 6 clock            01/01/70 00:00      
                  P89C51RD2 6 clocks per machine cycle            01/01/70 00:00      
                     DESCRIPTION            01/01/70 00:00      
            Here we go again            01/01/70 00:00      
         Re:amazing            01/01/70 00:00      
   H or not            01/01/70 00:00      
      The chip is P89C51RD2            01/01/70 00:00      
         insufficient            01/01/70 00:00      
            I am not sure about that...            01/01/70 00:00      
               the 'H' is important            01/01/70 00:00      
                  is P89C51RD2HBP            01/01/70 00:00      
                     Solved            01/01/70 00:00      
   0xFF ???            01/01/70 00:00      

Back to Subject List