LZ: On subject of 2's complement format...


[Prev][Next][Index][Thread]

LZ: On subject of 2's complement format...




IN>Okay... NEG results in the 2's complement of a number.  This is
IN>basically the number*-1, if I am not mistaken.  Can someone
IN>verify this instruction, as it would make my current project
IN>( a new driver for the temp sensor ) a lot easier when dealing
IN>with negative temperatures.

IN>BTW, does anyone have source code or notes from when Ed Plese
IN>wrote the original software?  At this point, my remake can use
IN>multiple chip IDs and read a temperature.  However, for some
IN>reason the chip gets locked on that temperature and won't change
IN>until I run Ed Plese's program.  So somehow Ed wrote it to
IN>reset the LM75's onboard registers between reads.  However, I
IN>don't know how he did it.  Power-cycling the sensor does not work.
IN>I'm in desperation, almost ready to disassemble the original
IN>code to find out how he did it.  ( At least I know that his read
IN>routines are near-exactly like mine, but HOW DID HE DO THE
IN>RESET? )

IN>Better yet, has anyone heard from him or Per Finander in the last
IN>year or so?  From what I found, Ed wrote the software and the
IN>basic design while the latter created the I2C routines now available
IN>on TICALC.ORG and finished the final schematic of the sensor.

IN>Thanks for any help you can give.

IN>Ryan J. Myers ( Webmaster )      rmyers@inetarena.com (ICQ 1473314)
IN>Portland, Oregon ( US )          http://boris.inetarena.com/
IN>WWW Design, Z80 Assembly / Win95 Programming, CGI Scripting, 3D Graphics
IN>--------------------------------------------------------------------------
IN>The contents of this email are my own opinions and do not represent the
IN>positions of my employers unless specifically stated as such.


Here is an exact quote from "Programming the Z80" by Rodnay Zaks

On Page 358:

Description: Contents of the accumulator are subtracted from zero (two's
complement) and the result is stored back in the accumulator.

BTW the accumulator is register A

David