Article View: borland.public.cppbuilder.nativeapi
Article #17104R: Reading From Serial Port
From: Steve
Date: Wed, 09 Apr 2003 11:47
Date: Wed, 09 Apr 2003 11:47
27 lines
1874 bytes
1874 bytes
> I am able to write out data to the serial port which has a twisted cable > attached. However, I am unable to read any data in... Maybe I haven't understood correctly your problem, but there's something strange in your code. What is the problem exactly? How can you say you don't receive any data? Have you tried the following values instead of yours? SerialPort.CommTimeOuts.ReadIntervalTimeout = MAXWORD; SerialPort.CommTimeOuts.ReadTotalTimeoutMultiplier = 0; SerialPort.CommTimeOuts.ReadTotalTimeoutConstant = 0; SerialPort.CommTimeOuts.WriteTotalTimeoutMultiplier = 0; SerialPort.CommTimeOuts.WriteTotalTimeoutConstant = 0; > inread=ReadFile(SerialPort.hComm,outbuffer,1,&dwBytesRead,NU LL); If I'm not wrong outbuffer is not allocated. Are you sure this line is correct? Have you tried to define outbuffer as "char outbuffer[2]" (the same for inbuffer, as well)? HTH, Steve.
Technical Details
Message-ID:
<3e94086a$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-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3e93d88d@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,c1814f9ecc8efe9a X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-04-09 04:56:21 PST Reply-To: "Steve" <steve_alettoANTI@SPAMhotmail.com> From: "Steve" <steve_alettoANTI@SPAMhotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3e93d88d@newsgroups.borland.com> Subject: R: Reading From Serial Port Date: Wed, 9 Apr 2003 13:47:35 +0200 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 NNTP-Posting-Host: 80.105.101.132 Message-ID: <3e94086a$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1049888874 80.105.101.132 (9 Apr 2003 04:47:54 -0800) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail