delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/25/16:32:39

From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Serial port access
Date: 25 May 1997 19:02:41 GMT
Organization: The National Capital FreeNet
Lines: 31
Message-ID: <5ma2ch$b3o@freenet-news.carleton.ca>
References: <3388185A DOT 7B09D3E3 AT iol DOT it>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet5.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Guido Gonzato (guido DOT g AT iol DOT it) writes:
> Hello,
> 
> I want to rewrite in C a program I wrote in gwbasic for controlling a
> digital oscilloscope.
> 
> I need to know how to access the serial port(s). I only have to read a
> stream of bytes from COM1:, filter out the junk, and write the data to a
> file.

If I am not too much mistaken, you ought to be able to do it with
something like this:

FILE *the_oscilliscope;
the_oscilloscope=fopen ("COM1","rb")  // Opens the port for reading in binary


...

do {
  while eof(the_oscilloscope) {
    // no new data, do nothing
  }
  deal_with_some_data (getc(the_oscilloscope));
} while (!exit_flag);
--
    .*.  Where feelings are concerned, answers are rarely simple [GeneDeWeese]
 -()  <  When I go to the theater, I always go straight to the "bag and mix"
    `*'  bulk candy section...because variety is the spice of life... [me]
Paul Derbyshire ao950 AT freenet DOT carleton DOT ca, http://chat.carleton.ca/~pderbysh

- Raw text -


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