🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #16408

Re: WriteFile problems (help me!)

#16408
From: Stephan
Date: Thu, 15 May 2003 11:46
54 lines
2732 bytes
Good Morning!
I've read Mr. Moeller's and Mr. Mulroy's advise, and wish to add some
diagnostic advise.
1) you are having a problem with code locking up after calling it a few
time.
2) you are sending data to the serial port.
3) programs are using Writefile to send data to the COMM port all the time
without messing up.

alright, now lets try to figure out what's going wrong.
Try running the program several times, but keep tract of how many bytes
you've written to the port.
using just a rough guess,
40times/sec * 20bytes = 800bytes/sec
19200bit/sec / 11bits/byte xmitted = 1745 bytes / sec.
okay, so you shouldn't be overrunning the buffer.
are the 40/times a second evenly spaced? what's driving this?

You didn't say, but are you running any of this in multiple threads?
you might be having a thread problem and not a COMM problem.

when the writefile doesn't return, what does your LCD do?

while you are doing things in your program with the comm port, what else are
you doing?
did you try creating a disk log of the info that you are sending to the comm
port?
maybe the data is buggering up
do you test the result of bytes written?

I know it's frustrating debugging code when it stops at a place you can't
examine,
but hang in there, there are techniques to get around that!

have Fun
Stephan


"MWP" <mwp@overclockers.com.au> wrote in message
news:3ec25f43$1@newsgroups.borland.com...

Hi all...

Im am doing the following simple line that is running about 40 times a
second:
WriteFile(ComHandle, Block, Length, &BytesWritten, NULL);

ComHandle is pointing to a COM port opened at 19200.
Length is never more than 20 (verified).

It will work for a random amount of time then, WriteFile gets called but
doesnt return... ever.

Anyone know what the problem could be?
Technical Details
Message-ID: <3ec37e2d$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail
References: <3ec25f43$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,9ac30f5163521f9f
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-05-15 04:55:38 PST
From: "Stephan" <slaska@devarinc.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3ec25f43$1@newsgroups.borland.com>
Subject: Re: WriteFile problems (help me!)
Date: Thu, 15 May 2003 07:46:53 -0400
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
NNTP-Posting-Host: 64.252.14.74
Message-ID: <3ec37e2d$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1052999213 64.252.14.74 (15 May 2003 04:46:53 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-09!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail