This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Why Does software Simulation results sometimes vary from real time systems?

Hi,
I am trying to implement serial communication from my real time hardware system. I have developed my source code KEIL and verified using serial software simulator of KEIL. I am getting perfect result. But when I am trying to implement on the real time hardware system I am unable to get the desired result. I am using the real time hardware system with a baud rate of 2400bps. Can anyone please explain what could be the possible reason.

regards.
raghun

Parents Reply Children
  • "You can not make exact 9600 Baud with a 24MHz crystal, the Baudrate wouldn't be exact."

    Not exact, but close enough (+0.16% error).

        PCON |= 0x80;       // Set double-rate bit, SMOD
    
        TMOD &= 0x0F;       // Clear Timer 1 control bits, upper nibble, in TMOD register
        TMOD |= 0x20;       // Put Timer 1 in 8-bit, auto-reload mode (Timer 1, Mode 2)
        TH1 = 0xf3;         // Define Timer 1 reload value
    
        RCLK = 0;           // Define Timer 1 as the UART receiver baud clock (T2CON.5)
        TCLK = 0;           // Define Timer 1 as the UART transmitter baud clock (T2CON.4)
        TR1 = 1;            // Enable Timer 1 as baud-rate generator (TCON.6)
    


    Check it out at: http://www.keil.com/c51/baudrate.asp