Lorick, given a 16 Bit integer, an unsigned integer has a range of 16 Bits. A signed integer has a range of +/- 15 Bits with the MSB being the sign Bit as James described. Note, James' example uses 2's complement to represent negative numbers which is the common method. - Tom At 05:08 AM 2/8/00 -0500, Lorick wrote: >----- Original Message ----- >From: James Cameron >To: >Sent: Tuesday, February 08, 2000 3:47 AM >Subject: Re: 16 bit PIC math question on subtracting > > >> 0000 0000 0000 0000 = 0 >> 1111 1111 1111 1111 = -1 >> 1111 1111 1111 1110 = -2 >> 1111 1111 1111 1101 = -3 >> > >So using signed numbers then, I reduce the number to 15 bits + 1 sign? So >my highest decimal representation is 2^15 = 32768? In that case, if I want >signed (if I'm right it all makes sense now and is coming back to me, >thanks) binary representation from an A/D channel, instead of having an >input signal between 0 and 5v and converting it to decimal 0 to 255, I would >be interested in scaling my maximum decimal reading so that I could square >the maximum and have it fit within decimal 32768, which decimal 180 does >nicely I think, so I would possibly reconsider having my analog input >between 0 and 3.5v instead of 0 and 5v to have a maximum reading of decimal >180? > >I can anticipate all kinds of things like losing resolution maybe, and >otherwise having better ways to go about this like maybe still keeping my >0-5v input but software scaling the 0-255 result.....but right now time is >the issue for me and I'm better with the hardware restriction. Losing >resolution would probably be ok for my application (experiments to come). > >But was I on the right track with the signed 15 bit integer thing? ------------------------------------------------------------------------ Tom Handley New Age Communications Since '75 before "New Age" and no one around here is waiting for UFOs ;-)