UART Reception

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sundarr
    New Member
    • Aug 2006
    • 9

    UART Reception

    Hi all,

    I am doing some work on UART. the code to recieve data on my UART from Hyperterminal is as follows:

    Recieve(Count, Destination)
    {
    //Monitor the port to recieve data and continously poll the data.
    //A data byte recieved will set the LSB in LCR to 1.
    //Thus the CPU has safely read the data
    do
    {
    status = Value in LSR & 0x01;
    }while(!status) ;

    //Once read copy the value in RBR to the dest
    valueAtdest = ValueinRBRregis ter;

    }

    Now this particular code skips out the second character 0x0A if its previously accompnaioed by oxoD.
    Say for every combination of 0x0D 0x0A the reciev function simple skips the 0x0A character due to which the next incoming meesages get lost.:(

    Any help would be welcome

    :)
    Sundar


    }
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Are you sure that it is your code skipping the character and not Hyperterminal deciding not to send it?

    In Hyperterminal select

    File -> Properties

    Then on the properties dialogue select the Settings Tab

    Press the 'ASCII Setup...' button

    On the ASCII Setup Dialog check the setting of the first option in the 'ASCII Sending' box, 'Send line ends with line feeds'. This should be checked if you want to receive 0x0D 0x0A



    And finally if you are building a comms application get yourself a better terminal emulator than Hyperterminal, it is useless.

    Comment

    • sundarr
      New Member
      • Aug 2006
      • 9

      #3
      Thanx Banfa for notifyin on that front. I tried this out and found out the prob. But can u please tell me why this thing wasnt working that way?

      And i hve even bigger query. Although i hve a baud rate of 115200 bps, i need to send thru hyperterminal the data at a character delay of 1 ms else which the receiver UART doesnt accept valid data. and this 1 ms delay is costing my application a whopping 30 minutes to send a 100 kb file to the receiver. the code for the reception remains same as it was earlier. can u help me out this time?

      :)
      Sundar

      Comment

      • Banfa
        Recognized Expert Expert
        • Feb 2006
        • 9067

        #4
        Since you are polling for receive rather than processing a receive interrupt I would guess that some part of the receiving program is holding the receive loop off (i.e. preventing it running) for that time.

        Comment

        Working...