By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,148 Members | 739 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,148 IT Pros & Developers. It's quick & easy.

UART Reception

P: 9
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 = ValueinRBRregister;

}

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


}
Oct 18 '06 #1
Share this Question
Share on Google+
3 Replies


Banfa
Expert Mod 5K+
P: 8,916
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.
Oct 18 '06 #2

P: 9
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
Oct 18 '06 #3

Banfa
Expert Mod 5K+
P: 8,916
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.
Oct 18 '06 #4

Post your reply

Sign in to post your reply or Sign up for a free account.