🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.hardware
Article #2237

Re: handshake desired on CPU side of COM port

#2237
From: Ralph Wade Phillips
Date: Sat, 14 Jul 2001 05:36
39 lines
2928 bytes
Howdy!

"John Becich" <jbecich@glendale.net> wrote in message
news:%HN37.1912$23.229253@newsread2.prod.itd.earthlink.net...
> I'm reading the COM1 port of my computer with turbo C++ code.  I'm using a
> simple loop in my code to repeatedly read the COM port and printf the
result
> to the computer screen.

        No, you're reading a single port that's the data register.  There's
a difference.

>
> The problem is that my program cannot tell the difference between fresh
data
> on that COM port, and stale data.  I get a repeated print out to the
screen.

        That's because you're not checking the status lines off of the UART.
If we check out some of National's application notes on, say, the NS16550AN
UART (which the I/O of your machine is based on), we find out that AN-660
(at http://www.national.com/an/AN/AN-660.pdf ) which is sample code for a
NS32GX32 processor (but the algorythms are the same for any processor) that
at  BASE+3, bit 0, is a flag that states if there's new data in.

        Why complicate matters?  Just ask the UART if there's anything
available.

>
> Isn't there some kind of flag that goes up when new data arrives incoming
to
> the port from a serial communications line; and down after my computer has
> read that data?  Might that be DSR, DTR, or similar?

        None of these.  Again, checking out the specs on the chip that the
Super I/O is based on (another appnote is AN-628 at
http://www.national.com/an/AN/AN-628.pdf ) is HIGHLY recommended.

        RwP
Technical Details
Message-ID: <9iolor$k3k2g$1@ID-81734.news.dfncis.de>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!ralphp.microgear.NET!not-for-mail
References: <%HN37.1912$23.229253@newsread2.prod.itd.earthlink.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f70d1,e23dea08d1c53ace
X-Google-Attributes: gidf70d1,public
X-Google-Thread: 105a80,e23dea08d1c53ace
X-Google-Attributes: gid105a80,public
X-Google-Thread: 114af8,e23dea08d1c53ace
X-Google-Attributes: gid114af8,public
X-Google-Thread: f5f89,e23dea08d1c53ace
X-Google-Attributes: gidf5f89,public
X-Google-ArrivalTime: 2001-07-13 22:36:32 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!130.133.1.3!fu-berlin.de!uni-berlin.de!ralphp.microgear.NET!not-for-mail
From: "Ralph Wade Phillips" <ralphp@techie.com>
Newsgroups: alt.comp.hardware,alt.comp.hardware.homebuilt,borland.public.cpp.turbocpp,microsoft.public.win2000.hardware
Subject: Re: handshake desired on CPU side of COM port
Date: Sat, 14 Jul 2001 00:36:25 -0500
Organization: Phillips Enterprises
Lines: 41
Message-ID: <9iolor$k3k2g$1@ID-81734.news.dfncis.de>
References: <%HN37.1912$23.229253@newsread2.prod.itd.earthlink.net>
NNTP-Posting-Host: ralphp.microgear.net (63.65.144.1)
Mime-Version: 1.0
Content-Type: text/plain;
 charset="Windows-1252"
Content-Transfer-Encoding: 7bit
X-Trace: fu-berlin.de 995088987 21090384 63.65.144.1 (16 [81734])
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200