delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/10/13/17:00:52

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
Newsgroups: comp.os.msdos.djgpp
Subject: reading from com1: => driving me nuts
From: muellernick AT gmx DOT de (=?ISO-8859-1?Q?Nick_M=FCller?=)
Date: Wed, 12 Oct 2005 20:01:35 +0200
Message-ID: <1h4c4cp.1b942cr1g5grtnN%muellernick@gmx.de>
Organization: messy desktop AKA messy shop
User-Agent: MacSOUP/D-2.7 (unregistered for 166 days)
NNTP-Posting-Host: 84.57.20.111
X-Trace: news.arcor-ip.de 1129140100 84.57.20.111 (12 Oct 2005 20:01:40 +0200)
Lines: 41
X-Complaints-To: abuse AT arcor-ip DOT de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

I hope, this subject isn't OT here.

I've been fiddling around for a hole day now, but can't get it working:

I want a serial communication with a uC. The Baud-rate is 115200, 8 bit,
1 stop bit, no parity. I've tested the communication with a
terminal-program (on the same machine) and that works. I also checked
the timing with a scope, and it's OK to.

So now I want to establish a communication from within my C-program
(using djgpp, of course). I do the following:

set propper params with MODE com1:blablabla


FILE* file;
int c;

file = fopen("com1:", "ab");
if (file != NULL) {
  while ((c = fgetc(file)) != EOF)
    printf("%i ", c);
}

What is happening?
I can send characters to the uC that are propperly understood and the uC
is sending the answer. **BUT** I always get 16382 CHR0 on the DOS-side.
If the uC is not answering, I get 0 characters from file.

Oh, if it makes a difference, I (currently) let my program run in a
DOS-box under Win XP pro.

What am I doing wrong?

TIA for any hints,
Nick
-- 
Motor Modelle // Engine Models
http://www.motor-manufaktur.de

- Raw text -


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