On Mon, 20 Jan 1997, Tim Kerby wrote: > What is the difference between 2s complement, logical complement and > complement (NOT) and any others? > I am not so hot on the logical operations of PICs and help would be > appreciated. Is there a program which you enter binary numbers and a pic > instruction sequence and you see the results calculator style? Can you also > reccomend any books on binary / boolean logic. Number: 1010 'NOT' : 0101 (also called 'ones complement') '2s' : 0110 (take 0101, add 0001) To make a 2s complement, take the ones complement and add 1 to the last digit. Why? The 2s complement of a number is used to represent a negative value. So, if you are subtracting a number, you can instead add its 2s complement. This simplifies the hardware design considerably! There is a little more to it than that, but I can't give all the details off the tip of my tongue (fingers?). For more info, look for books on beginning computer programming or intro to digital design (like in the technical section of a used book store). Usually the in the first or second chapter will be a discussion of number bases, complements, binary arithmetic, etc. -Paul Bennett pbennett@kilby.elee.calpoly.edu