1、Chapter 2 Number systems and codes u Decimal and Binary u Unsigned and Signed u Code for Numbers and CharactersPositional number systemsUse few digit to express infinite values Each digit position has a different weightDefinition:121012.pniiirddddddDNumber digit base/radixNumber:a string of digits;E
2、ach digit position has a different weight;Radix is written as 10 in any system.2211001122rdrdrdrdrdDDdrPositional number systemsDecimal system:base is 10,the digit may be 0 to 91012101011011001011.101Binary system:base is 2,the digit may be 0 or 110122212120211.101bit:one digit in binary system;Posi
3、tional number systemsBased on definitions:10764322109375.0222200110110.01012452542222001101105422109375.08Conversion:Binary to Decimal102?1101.001010245148320010110110428125.22/451101.0010Conversion:Binary to DecimalConversion:Decimal to binary For integer numbers:divided by 2,get its remainders;210
4、10110011179Examples for 8-bit binary numbers:17989 442211521 1 1 0 0 1 1 0 1For decimal fraction numbers:multiplied by radix,and get its integers;Examples for 8-bit binary numbers:21000101011.017.00.170.34 0.681.360.721.440.881.761.52Conversion:Decimal to binary Different number systemsP.28 Table 2-
5、1A short way to represent numbers Binary to octal:3-bit to one digit;Binary to hexadecimal:4-bit to one digit;Key point:divide from the radix point!168285613111011100010BB1682.226.134211.1011100010CEExamples:Conversion:from one system to another Summary:p.31 Table 2-2Binary numbers with certain widt
6、h;The numbers always be set as 0.xxxxxxxx;We can take these numbers as integers!0011011000110110.0Example for an 8-bit binary number:MSB/LSB Numbers in digital systemOperations for unsigned numbersBasic rules:0+0=0 1+0=1 1+1=10 10-1=1 Addition and subtractionC:carry S:sum B:borrow D:difference Basic rules:0A=0 1A=A Multiplication Shift-add:use adders and shift-registers;The product width will be 2n!Operations for unsigned numbers