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

hyperterminal

hello everyone....my program transmits 'SAMPLE CODE' continuously on the uart...chip 'm using is p89v51rd2..the problem is nothing is being displayed on the hyperterminal...i checked the TXD pin on the scope,i can c pulses there...i've checked the serial cable,shorted pins 2 n 3,even that works fine....watelse could be the problem..??help me out...

Parents
  • the serial communication code is set at a baudrate of 9600 (RCAP2H = 0xFF; RCAP2L = 0xB8;) at an oscillator frequency of 11.0592MHz...when i interface the board to a PC hyper-terminal,junk values are being transmitted..but when i changed the PC hyper-terminal settings to a baudrate of 4800,its receiving and transmitting without any error....what could be the problem?? i checked the crystal on the board..it gives a sine wave with the proper frequency..

Reply
  • the serial communication code is set at a baudrate of 9600 (RCAP2H = 0xFF; RCAP2L = 0xB8;) at an oscillator frequency of 11.0592MHz...when i interface the board to a PC hyper-terminal,junk values are being transmitted..but when i changed the PC hyper-terminal settings to a baudrate of 4800,its receiving and transmitting without any error....what could be the problem?? i checked the crystal on the board..it gives a sine wave with the proper frequency..

Children
  • "what could be the problem"

    Have you read previous posts?

    Have you visited previously posted links?

    Did you plan to?

    Have you made some own speculations?

  • i've checked all the previous links..the values calculated are all correct....i still cant figure out what is it wrong that 'm doing??

  • hhey i changed the value of RCAP2L from B8 to DC and its working...thanQ everyone..


  • I don't believe you!

    Check again at http://www.keil.com/c51/baudrate.asp - and note that you need to specify more than just the oscillator frequency and RCAP2...

    And think about what settings could possibly change the speed by a factor of two...

    Review the basics of the 8051/2 UART:

    www.8052.com/tutser.phtml

    http://www.8052.com/tut8052

  • But do you understand why you needed to do that?

    Or, to put it the other way, why you were previously getting half the baud rate you wanted?

    Again, you should probably review the basics of the 8051/2 UART:

    www.8052.com/tutser.phtml

    http://www.8052.com/tut8052

    If you don't understand these basics, then you will keep getting stuck in the same trap!

  • "i've checked all the previous links..the values calculated are all correct....i still cant figure out what is it wrong that 'm doing??"

    So you have visited the link. But did you read the text?

    In a previous post in this thread - the same post that contained the link - there was this text:

    a. If Xtal= 12MHz and microcontroller in X2mode (6 cycles per 1machine cycle)
    or b. If Xtal= 24MHz and microcontroller in X1mode (12 cycles per 1machine cycle)
    

    In the linked calculator, there was a setting: "Machine Cycle 12 or 6"

    What conclusions did you make from the forum post, and from the setting in the calculator?

    Directly below the calculator, there was this text:

    X1_mode: 12cycles, uart_x1: SMOD=0
      TH1Reload = 256 - (XTAL / 12 / 32 / baud_rate)
    
    X1_mode: 12cycles, uart_x2: SMOD=1
      TH1Reload = 256 - (XTAL / 12 / 16 / baud_rate)
    
    X2_mode: 6cycles, uart_x1: SMOD=0
      TH1Reload = 256 - (XTAL / 6 / 32 / baud_rate)
    
    X2_mode: 6cycles, uart_x2: SMOD=1
      TH1Reload = 256 - (XTAL / 6 / 16 / baud_rate)
    

    Did you notice the division by 12 and division by 6 (which would agree with you getting exactly a factor 2 wrong baudrate)? What conclusion did you make?

    Did you notice that the calculator also had a question "SMOD 0 = uart_x1, 1 = uart_x2", and the demo evaluations below the calculator performed either a division by 32 or by 16 for SMOD=0 or SMOD=1? What conclusion did you make?

  • Then you do need to review those basics of the 8051/2 UART!

    Look at all the things that affect the baud rate...

    www.8052.com/tutser.phtml

    http://www.8052.com/tut8052

    See also: www.8052.com/.../120112

  • "'m sorry...but i didn't get u.."

    What, exactly, do you try to tell with that sentence?

    Exactly what didn't you get? Obviously not "u" since that is just the character following "t" in the alphabet.

    If there are a sentence or paragraph you don't understand, then you must write a post where you clearly indicate which sentence/paragraph you have trouble understanding. We just can't guess what you might be thinking.

    If playing with the linked baudrate calculator, you should also spend time looking through the documentation for the processor. There are lots of references available explaining exactly how the baudrate generator functions. What you can not do is just ignore parts of an expression that you don't understand. You must then dig deeper to try to find information explaining the concepts you have troubles with. Just ignoring something can sometimes _seem_ to be a working concept. Maybe, just maybe, code will work if you ignore if the processor runs with 6 or 12 clock cycles or setting of SMOD. But know understanding means that you are throwing a dice, just hoping that it will end up well.