Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucsd!pacbell.com!pacbell!hoptoad!hsfmsh!daemon From: tnixon@hsfmsh.UUCP (Toby Nixon) Newsgroups: comp.dcom.modems Subject: Re: Reading modem registers in C. Message-ID: <3841@hsfmsh.UUCP> Date: 17 Aug 90 21:27:17 GMT Sender: daemon@hsfmsh.UUCP Organization: Hayes Microcomputer Products, Inc. Norcross, Georgia Lines: 59 In article <10133@hubcap.clemson.edu>, rmorris@hubcap.clemson.edu (Robert Morris) asks: - I'm trying to read the registers in a Hayes 2400 modem. I issue a - ATS#? (# - number of the register). I then check 0x3f8 for the - value. What I get is an unlikely result (ie. 13 - number of rings - that occurred and no one called). I figure the 13 is the carriage - return sent to the modem. I'm using Turbo C 2.01 and would - appreciate any help recieved. You apparently don't quite understand how a Hayes (or compatible) modem sends back responses to ATSn? commands. It comes as a series of characters (not a single character), with the value in decimal ASCII representation (so it can be easily interpreted by a human being at a dumb terminal). Yes, this makes it a bit more difficult for us software writers, but it's still not all that hard to deal with. The characters you get back in response to the command depend on the setting of the "V" (verbose) command. In "V1" mode, the response looks like this (assume I issued the command "ATS2?"): 043OK where "" is the value of register S3 (default $0D or decimal 13, ASCII CR) and "" is the value of register S4 (default $0A or decimal 10, ASCII LF), and "043" is the ASCII representation of the value of the register, always as three digits with leading zeroes included ("043" is the decimal value of the default of register S2, the ASCII "+" character). In "V0" mode, the response looks like this: 0430 Note that the leading is gone, that the second in the middle is also removed, that the trailing is gone, and that the "OK" has been changed to "0". I suspect that the value 13 you've been reading from 0x3f8 is this trailing (if you're in V0 mode) or the leading (if you're in V1 mode). Your program should set either V0 or V1 mode directly (e.g. "ATV0") before issuing S? commands, so that you know the format to expect the responses to be in. Then, all you have to do is read the entire string of characters (not just one), pick out the decimal value of the register, and then convert it to an integer to use it. -- Toby ----------------------------------------------------------------------------- Toby Nixon, Principal Engineer Fax: +1-404-441-1213 Telex: 6502670805 Hayes Microcomputer Products Inc. Voice: +1-404-449-8791 CIS: 70271,404 Norcross, Georgia, USA BBS: +1-404-446-6336 MCI: TNIXON Telemail: T.NIXON/HAYES AT&T: !tnixon UUCP: ...!uunet!hayes!tnixon Internet: hayes!tnixon@uunet.uu.net MHS: C=US / AD=ATTMAIL / PN=TOBY_L_NIXON / DD=TNIXON -----------------------------------------------------------------------------