Path: utzoo!mnetor!uunet!unisoft!hoptoad!dasys1!manes From: manes@dasys1.UUCP (Steve Manes) Newsgroups: comp.sys.ibm.pc Subject: Re: Serial Communications in C Message-ID: <2343@dasys1.UUCP> Date: 24 Dec 87 10:58:00 GMT References: <991@mhuxh.UUCP> Reply-To: manes@dasys1.UUCP (Steve Manes) Organization: Datamerica Systems, NYC Lines: 34 In article <991@mhuxh.UUCP> vxb@mhuxh.UUCP (Vern Bradner) writes: >Can anyone share their knowledge/experiences in writing C routines to >communicate with remote systems via the PC serial port? > >I tried inp and outp without much success. Are there any C libraries >that might make this job easier? Writing code to control the PC's serial port can range from fairly simple to gruesomely elaborate depending on what you want to do. However, in most applications you want to avoid the IBM's built-in ROM BIOS serial support because it doesn't support interrupt-driven character receipt, i.e. it doesn't buffer. If you're not all that experienced writing code for hardware and particularly the PC's 8250/16450 UART and 8259 interrupt controller the first thing you'll need to do is study how they work. did an excellent series on the IBM hardware interrupt structure several years ago. Another good source of reference is by Sargent & Shoemaker (Addison-Wesley). The 8250 can be tricky to work with if you're starting out with a blank page. I probably spent 6 months tweaking and refining (and fixing many subtle bugs) in my comm library. You can save yourself a lot of aggravation by purchasing the Greenleaf comm library, or equivalent. The downside is that you'll lose a valuable education in hardware programming. The upside: you'll sleep better knowing that you've got a predebugged library to work with. You can't just pop bits in and out of the comm port if you want an effective serial device controller. The UART has to be prepared and initialized beforehand. The Sargent/Shoemaker book explains this well. -- +----------------------------------------------------------------------- + Steve Manes Roxy Recorders, Inc. NYC + decvax!philabs!cmcl2!hombre!magpie!manes Magpie BBS: 212-420-0527 + uunet!iuvax!bsu-cs!zoo-hq!magpie!manes 300/1200/2400