Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] time of getchar

2011-07-08 by Dave McLaughlin

Hi there,

 

I am assuming you are using an interrupt driven serial port here? Best
option by the way as it gets filled under interrupts so less likely to lose
data. The following applies if this is turned on.

 

You need to check the variable rx_counter0 (check your code for the correct
name) before calling getchar()

 

If this is non-zero it indicates there is data in the buffer.

 

if(rx_counter0)

{

          ch = getchar();

}

 

You can actually check this for a certain value if you happen to know the
length of the data otherwise, you have to deal with variable length input.

 

Hope this helps?

Dave.

 

From: AVR-Chat@yahoogroups.com [mailto:AVR-Chat@yahoogroups.com] On Behalf
Of Ahmed Mostafa
Sent: 08 July 2011 01:40
To: AVR-Chat@yahoogroups.com
Subject: [AVR-Chat] time of getchar

 

  

command "getchar()"
if it didn't receive serial data 
does it skips this command or what
and if it skips it , how long does it take 
since this command "getchar()" is executed until it skips it ?





[Non-text portions of this message have been removed]

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.