delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/15/19:00:21

Message-ID: <3999C9A2.E15E3D12@aareus.com>
From: "Cyrus W." <cyrus AT aareus DOT com>
Organization: Aareus Software
X-Mailer: Mozilla 4.72 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: read a character string from a serial port ......
References: <8ncd7g$18p$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
Lines: 61
Date: Tue, 15 Aug 2000 16:52:19 -0600
NNTP-Posting-Host: 207.34.75.11
X-Trace: jekyl.ab.tac.net 966379936 207.34.75.11 (Tue, 15 Aug 2000 16:52:16 MDT)
NNTP-Posting-Date: Tue, 15 Aug 2000 16:52:16 MDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

You should use an ISR,
it will solve a lot of your problems.
Of course there's no need to reinvent the
wheel.  I don't have the link off hand, but
you may want to take a peek at SvaSync.

Cyrus

-
I'm currently seeking new employment opportunities.
Ideally I would like to use  C | C++ | Perl | Asm.
My resume is available at http://www.icrossroads.com/~brbi/
If your interested please contact me.


Florent wrote:

> Hi,
> I manage to read a character from the serial port but I'm having problemes
> for reading character string.
>
> Here is my function which read the character string :
>
> int ReceiveString (int ComNo,char *received,int *base) {
>
>   int b,i=0,j=0;
>   char string[127];
>
>   string[0]=NULL;
>
>   b = base[ComNo-1];
>   if (!b) return 0;
>
>   if ((inportb(b+STATUS) & 1) == 0) return 0;
>
>   while  (inportb(b+STATUS) & 1) {
>         inportb(b+STATUS);
>         string[i] = inportb (b);
>         i++;
>         string[i]=NULL;
>         delay(1);
>   };
>   strcpy(received,string);
>
>   return  1;
> }
>
> ComNo is the port com choosen, and base are the adress of the serial port.
> The things is that I can just read character by character, and sometimes I
> miss some character.
> I call my function in a loop, in order to get character (or character
> string) at any moment.
> I tried to put a small delay, but doesn't work well , I miss gain some
> characters.
> Does the serial port has a buffer ? Can we change the size of this buffer ?
> Do you have any clue for my function ?
>
> Thanks for helping me,
> best regards,
> Florent.

- Raw text -


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