Article View: alt.comp.hardware
Article #2238Re: handshake desired on CPU side of COM port
From: John Becich
Date: Sat, 14 Jul 2001 13:19
Date: Sat, 14 Jul 2001 13:19
64 lines
3714 bytes
3714 bytes
Ralph, Thanks for you response. I succeeded. See below for details. JB "Ralph Wade Phillips" <ralphp@techie.com> wrote in message news:9iolor$k3k2g$1@ID-81734.news.dfncis.de... > 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. Agreed. > > > > > 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. I did that by asking 0x3fd, bit 0, if it was a "1." When it came up "1" then I knew fresh data was waiting, and I fetched it, once. This solved the problem. Thus the appropriate UART (FIFO) flag is at base address + 5. > > > > > 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:
<IFX37.2749$23.342425@newsread2.prod.itd.earthlink.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mailReferences:
<%HN37.1912$23.229253@newsread2.prod.itd.earthlink.net> <9iolor$k3k2g$1@ID-81734.news.dfncis.de>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 105a80,e23dea08d1c53ace X-Google-Attributes: gid105a80,public X-Google-Thread: f70d1,e23dea08d1c53ace X-Google-Attributes: gidf70d1,public X-Google-Thread: f5f89,e23dea08d1c53ace X-Google-Attributes: gidf5f89,public X-Google-Thread: 114af8,e23dea08d1c53ace X-Google-Attributes: gid114af8,public X-Google-ArrivalTime: 2001-07-14 06:19:29 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Reply-To: "John Becich" <jbecich@glendale.net> From: "John Becich" <jbecich@glendale.net> Newsgroups: alt.comp.hardware,alt.comp.hardware.homebuilt,borland.public.cpp.turbocpp,microsoft.public.win2000.hardware References: <%HN37.1912$23.229253@newsread2.prod.itd.earthlink.net> <9iolor$k3k2g$1@ID-81734.news.dfncis.de> Subject: Re: handshake desired on CPU side of COM port Lines: 66 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: <IFX37.2749$23.342425@newsread2.prod.itd.earthlink.net> Date: Sat, 14 Jul 2001 13:19:36 GMT NNTP-Posting-Host: 209.179.38.99 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 995116776 209.179.38.99 (Sat, 14 Jul 2001 06:19:36 PDT) NNTP-Posting-Date: Sat, 14 Jul 2001 06:19:36 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Sat, 14 Jul 2001 06:17:03 PDT (newsmaster1.prod.itd.earthlink.net)