[comp.lang.c] Converting numbers between decimal /binary

greg@turbo.atl.ga.us (Greg Montgomery) (06/23/91)

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 <mask>" where <mask> 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!