Path: utzoo!mnetor!uunet!cbmvax!carolyn From: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Newsgroups: comp.sys.amiga Subject: Re: Serial device Message-ID: <3124@cbmvax.UUCP> Date: 11 Jan 88 16:42:30 GMT References: <1270@vaxb.calgary.UUCP> Reply-To: carolyn@cbmvax.UUCP (Carolyn Scheppner CATS) Organization: Commodore Technology, West Chester, PA Lines: 38 Keywords: carrier detect checking In article <1270@vaxb.calgary.UUCP> herr@calgary.UUCP (Charles Herr) writes: > > I am currently playing around with the serial device >and would like the following question answered. Can anyone help? > This is the problem: How do you check for Carrier Detect? >Assuming I have opened the serial.device properly, would the >following code work? > > Serial->IORser.io_Command = SRCMD_QUERY; > DoIO(Serial); > if(Serial->io_Status & `\040`) > then carrier_detected = 1; > else carrier_detected = 0; > >Maybe some of the variable names are wrong (I don't have my code >handy right now), but I am doing the right thing? Basic concept is correct, but 1. Serial.doc lists carrier detect status bit as ACTIVE LOW, so your test is probably backwards. (at least if you want carrier_detected to be TRUE when carrier IS detected) 2. Serial request io_Status is a UWORD variable and you are &'ing it with a character. C might extend that properly (as long as bit7 isn't set in the character) but I certainly wouldn't do it that way. You should be &'ing with 0x0020 or even better, set up a #define like #define SDF_ST_CARRIER (1L<<5) and & with that. -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Carolyn Scheppner -- CATS >>Commodore Amiga Technical Support<< UUCP ...{allegra,ihnp4,rutgers}!cbmvax!carolyn PHONE 215-431-9180 =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=