Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!samsung!emory!wa4mei!turbo!greg From: greg@turbo.atl.ga.us (Greg Montgomery) Newsgroups: comp.lang.c Subject: Converting numbers between decimal /binary Message-ID: <0XXy41w164w@turbo.atl.ga.us> Date: 23 Jun 91 00:30:56 GMT Reply-To: greg@turbo.atl.ga.us Distribution: na Organization: Montgomery Consultants, Inc. Lines: 26 I'm trying to write a program to control an expansion card in my computer. The card accepts ASCII commands written to a memory address. I'm trying to run tests on it, but I'm having a problem. To run a test on it, you have to send it "TEST " where is a five-digit decimal value which is converted by the device into a 16-bit unsigned binary integer. Only the low-order seven bits are used; the upper nine are ignored. Bit 0 is the least-significant. I can run different tests on the device by setting different bits: Bit 0 - ROM test bit 1 - data memory RAM test bit 2 - scratchpad RAM test bit 3 - ADC test etc.. My only problem is I don't know how to set certain bits, so I have no idea what the five-digit decimal value should be. I apologize if this sounds like a dumb question, but I have no idea how to do this. I'm hoping someone can straighten me out on this. Thanks.. ---- Greg Montgomery | Montgomery Consultants, Inc. | Atlanta, Georgia, U.S.A Internet: greg@turbo.atl.ga.us | Home of the '96 UUCP: {rutgers,ogcise,gatech}!emory!turbo!greg | Olympics!