www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/16/03:51:20

Date: Wed, 16 Aug 2000 10:50:04 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: Florent <florent AT oih DOT rwth-aachen DOT de>
cc: djgpp AT delorie DOT com
Subject: Re: read a character string from a serial port ......
In-Reply-To: <8ncd7g$18p$1@nets3.rz.RWTH-Aachen.DE>
Message-ID: <Pine.SUN.3.91.1000816104640.5730C-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 15 Aug 2000, Florent wrote:

>   while  (inportb(b+STATUS) & 1) {
>         inportb(b+STATUS);
>         string[i] = inportb (b);
>         i++;
>         string[i]=NULL;
>         delay(1);
>   };

Why are you delaying the execution for 55 milliseconds (1 clock tick)?  
That's a very long time, and will surely cause you lose characters for 
any baudrate above 180.  The default baudrate is 9600, which is *way* 
higher.

Instead of calling `delay', simply make the program loop until a 
character arrives (there's a certain bit in the UART that tells that).

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019