1.4 (1, 2, 3) 1.5 (1, 3) 1.61.10 (1, 3, 5) 1.12 (2, 4)1.141.161.17 (1,3) 1.19 (1, 3, 5)Homeworks (第三版):1Chapter 1. Number systems and codes第一章. 数制与编码2Content 本章内容:1. Number systems and their conversions 数制及其相互转换2. BCD and Grey codes BCD和格雷码3. Signed binaries 带符号的二进制数Extended learningInformation theory and coding 信息论与编码Content 本章内容:1. Number systems and their conversions 数制及其相互转换2. BCD and Grey codes BCD 和格雷码3. Signed binaries 带符号的二进制数Extended learning Information theory and coding 信息论与编码Therefore, in a general sense, information isKnowledge communicated or receivedconcerning a particular fact or circumstance or rather, information is an answer to a question. Information cannot be predicted and resolves uncertainty.§1.2 Number systems 数制1.A number system consists of an ordered set of digits, with relationshipdefined for addition, substraction, multiplication, and division. 定义了加、减、乘、除关系,并按照一定顺序进行排列的数字集合称为数制。
2.Instead of decimal used in ordinary life, binary, octal and hexadecimalare more commonly used in digital systems. 同生活中常用十进制数不同,数字系统中更常用的数制是二进制、八进制和十六进制。
3.The radix (r), or base, of the number system is the total number ofdigits allowed. 数字的总个数称为数制的基数:Number systems decimal (r =10)binary (r =2)octal (r =8)hexadecimal (r =16)561. Decimal 十进制●Ten symbols in decimal system :0, 1, 2, 3, 4, 5, 6, 7, 8, 9. The radix is 10. 十进制包含十个数码,基数为10(逢十进一)。
●Digits are located at different positions, the values of which are different. The value of a position is defined as the weight . 权:表示该位置的大小。
●The weight of each position in the decimal system is a power of radix 10。
十进制中每一个位置对应的权都是其基数10的幂。
●A number can be written in polynomial (多项式) form :()=1032.1942101×1109×+0104×+1103−×+2102−×+7--weight of the digit第i 个数字的权值--The digit第i 个数字In general, any number N of radix r can be written in the polynomial form (按权展开):1101,...,,,...,.n mN a a aaa −−−=n --number of integer digits 整数部分的位数i a th i ir m --number of fractional digits 小数部分的位数th i 1n iii ma r −=−= Integer digits Radix point Fractional digits82. Binary 二进制●Two symbols in a binary system :0, 1. The radix is 2. 二进制包含两个数字,基数为2(逢二进一)。
●The weights in the binary system are powers of radix 2。
二进制权值都是基数2的幂。
●A number can be written in polynomial (多项式) form :()211010.11=412×202+×112+×002+×212−+×26.75=312+×112−+×9Table.1 Decimal vs. Binary012345678910111213141516DecimalBinary0110111001011101111000100110101011110011011110111110000122232422n2(1000...00)=n zeros121−221−321−421−221(111...11)n−=n onesThe advantage of using binary in digital systems 数字系统中使用二进制的优点1.Easy to describe with hardware. 便于硬件描述。
1 0Switch开关OnOffLamp灯泡OnOffDiode/Transistor二极管/晶体管ConductCut offImpulse脉冲ExistVanishVoltage电压HighLow2.Nice properties of identifiability and anti-interference. 易于辨识、抗干扰能力强。
10However, the binary system uses too many bits to represent a large number, and thus may be sometimes inconvienence to use. 然而,二进制表示大数时占用位数过多,因此在某些场合下不便使用1265:4 bits in decimal, but 11 bits in binary (10011110001)The larger the number is,the more obvious the disadvantage is .So octal and hexadecimal systems are also used. 因此,八进制和十六进制也常常使用。
11123. Octal 八进制●Eight symbols in an octal system :0, 1, 2, 3, 4, 5, 6, 7. The radix is 8. 八进制包含八个数码,基数为8(逢八进一)。
●The weights in the octal system are powers of radix 8。
八进制权值为基数8的幂。
●A number can be written in polynomial (多项式) form :=8)47.326(+×283+×182+×086+×−184287−×10)62.214(=0.12 0.5 6 16 192++++=13Table.2 Octal vs. Decimal and Binary012345678910111213141516Decimal Binary 0110111001011101111000100110101011110011011110111110000Octal1234567101112131415161720144. Hexadecimal 十六进制●Sixteen symbols in a hexadecimal system :0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F . The radix is 16. 十六进制包含十六个数码,基数为16(逢十六进一)。
●The weights in the hexadecimal system are powers of radix 16. 十六进制权值为基数16的幂。
●A number can be written in polynomial (多项式) form :=16)4.3(B CE +×2163+×11612+×01614+×−116421611−×0.0430.25 14 192 768++++=10)293.974(=15Table.3 Hexadecimal vs. Decimal, Binary, and Octal012345678910111213141516Decimal Binary 0110111001011101111000100110101011110011011110111110000Octal 01234567101112131415161720Hexadecimal123456789ABCDEF10165. γsystem 任意进制●γsymbols :0, 1,…, γ-1. The radix is γ. 包含γ个数码,基数为γ。
●The weights in the γsystem are powers of radix γ. 任意进制权值为其基数的幂。
●A number can be written in polynomial (多项式) form :210127(345.61)3747576717−−=×+×+×+×+×17§1.3 Base conversions 数制间转换1.Convert γsystem to decimal 任意进制向十进制转换:Write the number in γ system in polynomial form 按权展开即可:101020345)25.57()2121212121(=×+×+×+×+×−=2)01.111001(2.Convert decimal to γ system 十进制向任意进制转换:1)For the integer part of a number, divide it by the radix until the quotient is 0, put the remainders in reversed order; 整数部分,除以γ取余,直到商为0为止,余数按逆序排列2)For the fraction part of a number, multiply radix and put the integer in order.小数部分,乘γ取整,整数部分按顺序排列192)小数部分,乘γ取整,顺序排列integer 01 ……………….0 ……………….1 ……………….MSB In order 顺序0.6x 21.2x 20.8x 21.60.2x 20.4102(0.2)( .0011)→210)0011.100111()2.39(=223. Conversions between Binary and Octal 二进制和八进制的互相转换328=Method: Group the digits in groups of 3digitsin both directions from the radix point.以小数点为界向两侧划分,三位一组,不够添0453651(1563.54)8(1 1 0 1 1 1 0 0 1 1. 1 0 1 1 )2=Note the last 1: 100---4the first 1: 001---1110)2001.011101(010(253.16)8=The zeros at both ends could be ignored.One bit of octal can be expressed by three bits of binary.234. Conversions between Binary and HexadecimalMethod: Group the digits in groups of 4 digitsin both directions from the radix point.以小数点为界向两侧划分,四位一组,不够添0ABDE51(15ED.BA)16(1 0 1 0 1 1 1 1 0 1 1 0 1.1 0 1 1 1 0 1)2=1)2101001111110.01011101(11One bit of hexadecimal can be expressed by four bits of binary4216=(3D5E.7A8)16=24§1.4 Codes 码integer1 ……………….0 ……………….1 ……………….MSBIn order 顺序0.6x 21.2x 20.8x 21.60.2x 20.4...(0.2)10=(0.001100110011…)2Many non-integral values may have infinite digits in binary.很多有限小数的二进制形式包含无限多个数字代码是指用于表示信息的一组符号,通常在计算机以及其他数字系统中,用于不同种类信息的处理、存储和交换。