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 ho hoh

It is not true :
    rx_counter0 
true is :
    rx_counter!=0
and this variable will be declared by codevision codewizard



________________________________
From: Ahmed Mostafa <justforstudy2011@gmail.com>
To: AVR-Chat@yahoogroups.com
Sent: Friday, July 8, 2011 14:03:24
Subject: Re: [AVR-Chat] time of getchar

  
and if i use interrupt
pleause clarify to me how to define variable rx_counter0 in the
interrupt routine

On 7/8/11, Ahmed Mostafa <justforstudy2011@gmail.com> wrote:
> thanks for your help
> actually i don't use interrupt
> and if it didn't receive data , i want it to skip the getchar command
> so can i use
>
> if(getchar()) //instead of if(rx_counter0)
> {
> ch = getchar();
> }
>
>
> On 7/8/11, Dave McLaughlin <dave_mclaughlin@nerdshack.com> wrote:
>> 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]
>>
>>
>



[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.