[En-Nut-Discussion] UART-Polling

Pedro Duarte PDuarte at milenio3.pt
Mon May 18 19:38:26 CEST 2009


You can use the "_filelength" function to check if there are available bytes in the uart before attempting a read.
Check the help file in the documentation "X:/.../ethernut-4.6.4/nut/doc/en/html/group__xg_crt_lowio.html".

Pedro

-----Mensagem original-----
De: en-nut-discussion-bounces at egnite.de [mailto:en-nut-discussion-bounces at egnite.de] Em nome de Timothy M. De Baillie
Enviada: segunda-feira, 18 de Maio de 2009 16:35
Para: Ethernut User Chat (English)
Assunto: Re: [En-Nut-Discussion] UART-Polling

Change the read timeout.

UsartIOCtl(&DEV_UART, UART_SETREADTIMEOUT, &timeout);

It's not quite the same, but it will allow you to not block the code 
completely.

Tim

Muhammad Yasir wrote:
> Why dont you better try for interrupts.As far as i know all such
> polling functions are blocking functions
>
> regards
> m.yasir
>
> On 18/05/2009, Martin Walda <Martin.Walda at sma.de> wrote:
>   
>> Hello,
>>
>> I use an Ethernut 2.1 Rev B Board with an ATMega 128 controller.
>>
>> My question is, how can I poll data from the uart interface? I have tried
>> fread, fgets and _read. All these functions seems to wait for incomming
>> character's. I am searching for a non blocking function.
>>
>> Thank you very much
>>
>> Martin
>>
>>
>>
>>
>> ______________________________________________________________________________
>>
>> SMA Solar Technology AG
>> Aufsichtsrat: Dr. Erik Ehrentraut (Vorsitzender)
>> Vorstand: Guenther Cramer, Peter Drews, Pierre-Pascal Urbon, Reiner
>> Wettlaufer
>> Handelsregister: Amtsgericht Kassel HRB 3972
>> Sitz der Gesellschaft: 34266 Niestetal
>> USt-ID-Nr. DE 113 08 59 54
>> WEEE-Reg.-Nr. DE 95881150
>> ______________________________________________________________________________
>>
>> _______________________________________________
>> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>>
>>     
>
>
>   
_______________________________________________
http://lists.egnite.de/mailman/listinfo/en-nut-discussion



More information about the En-Nut-Discussion mailing list