www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/30/02:19:57

Date: Tue, 30 Jan 1996 09:11:51 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Mark Lee <mlee AT heart DOT rri DOT uwo DOT ca>
Cc: djgpp AT delorie DOT com, mlee AT heartlab DOT rri DOT uwo DOT ca
Subject: Re: Parallel/Serial port programming

On Mon, 29 Jan 1996, Mark Lee wrote:

>   while(read)
>   {
>       while(inportb(STATUS_PORT))      /* check DATA is beening sent */
>       {                                /* read DATA and print        */
>  	   fprintf(stderr," DATA READ %d \n",inportb(DATA_PORT)); 
>       }
>       outportb(CONTROL_PORT,1);       /* Send Stop Request          */
>                                       /* End reading                */       
>        read=0;
>   }

It seems that if `inportb(STATUS_PORT)' returns zero first time through 
the `while(read)' loop (meaning probably that the other PC didn't write 
anything yet), your program immediately sets `read' to zero and exits the 
loop.  I would add another loop (before `while(read)' one) which waits 
for STATUS_PORT to go high until some timeout is reached, *then* enter 
the `while(read)' loop.

- Raw text -


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