🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Serial Communications issue

#10382
From: Antonio
Date: Mon, 26 Apr 2004 19:15
61 lines
2628 bytes
Hello,

    Excuse my english, is very bad.

    Testing configuration serial ports perceive a delay using
SetCommState( ... )

     You can stopped any time and execute your EscapeCommFunction(....)



"tomdas" <tomdais@otenet.gr> escreveu na mensagem
news:407c11a7@newsgroups.borland.com...
> Hi to all,
> I am trying to use com Port in Windows XP and I have some problems with
> it.What I exactly want
>  to do is to open the Com1 at 9600,n,8,1,set the RTS pin as an IO pin and
> SET it(-12V) and after
> this to write to and read from this serial port while the RTS is set.
>
> I work in C++ and I am opening the port using Createfile(not overlapping
> way) like this:
>
> MyComHandle=CreateFile(Comm,(GENERIC_READ |
> GENERIC_WRITE),0,0,OPEN_EXISTING,0,0);
>
> Then I am setting the DCB to the com1 having 9600,n,8,1,no flow control
for
> CTS,RTS,DTR,DSR
> (FALSE,RTS_CONTROL_DISABLE,DTR_CONTROL_DISABLE,FALSE) using the :
>
> SetCommState(MyComHandle,&MyComDCB);
>
> and I am also setting the COMMTIMEOUTS as 20,200,10,0,0
>
> After a while I am setting the RTS pin using the:
>
> EscapeCommFunction(SerialComHandle, SETRTS);
>
> After this whenever I am trying to read  from the serial port using the
> function:
>
> ReadFile(hFile,Buffer,Bytes2Read,BytesRead),NULL)
>
> I am getting the error 995(ERROR_OPERATION_ABORTED) (using the
GetLastError)
> which means:
> "The I/O operation has been aborted because of either a thread exit or an
> application request."
>
> If I don't use the EscapeCommFunction first the read doesn't give an
error.
>
> What am I doing wrong or which is another way to set RTS and then read and
> write to the serial port?
>
> Thanks in advance,
> Thomas
>
>
>
Technical Details
Message-ID: <408d5f43@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <407c11a7@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,a3ab790bb03822fa
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-04-26 12:37:35 PST
From: "Antonio" <antonio@napro.com.br>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <407c11a7@newsgroups.borland.com>
Subject: Re: Serial Communications issue
Date: Mon, 26 Apr 2004 16:15:18 -0300
Lines: 63
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 200.161.0.107
Message-ID: <408d5f43@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1083006787 200.161.0.107 (26 Apr 2004 12:13:07 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news.glorb.com!logbridge.uoregon.edu!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail