Page 856 - Mechanical Engineers' Handbook (Volume 2)
P. 856
4 Digital Computers 847
The procedure to convert from a positive number (e.g., 3) to the negative of that number
(e.g., 3) is:
(i) Invert all bits.
(ii) Add 1 to the result.
The procedure to convert from a negative number (e.g., 3) to the positive of that
number (e.g., 3) is:
(i) Subtract 1 (add 1).
(ii) Invert all bits.
Consider the following 3-bit examples:
Example 3 3 bits
To change a positive 3 (written as 011 in 3-bit binary) to a negative 3
(i) Invert all bits:
100
(ii) Add 1:
100
001
101 ⇒ 3
Example 4 To convert a 3-bit two’s compliment negative 2 to a positive 2.
(i) Subtract 1:
110
111
101
(ii) Invert all bits:
010 ⇒ 2
Now two two’s complement numbers can be added and this is like binary subtraction.
Consider the following example:
( 3) (2) ←→ 101
010 ←→ 1
111
4 DIGITAL COMPUTERS
Mechanical engineers should be familiar with the basic low-level operations of microcon-
trollers and computers so as to (1) understand what computers can and cannot do in mech-
atronic systems, (2) understand how computers are used in mechatronic systems (what their
job is), (3) be able to communicate with electrical and computer engineers on interdiscipli-
nary design teams, and (4) be able to select a microcontroller when designing a mechatronic
system. With these stated goals only the general concepts are presented here. The details of
low-level computer operation are numerous and beyond the scope of this chapter.

