numbering system

27
Malaysian Institute of Aviation Technology

Upload: nabila

Post on 02-Oct-2015

63 views

Category:

Documents


1 download

DESCRIPTION

Digital System

TRANSCRIPT

  • Malaysian Institute of Aviation Technology

  • Malaysian Institute of Aviation Technology

    LEARNING OUTCOME Binary, octal and hexadecimal Conversion between : decimal and binary, octal and

    hexadecimal systems and vice-versa BCD Signed numbers

    Conversion between positive and negative numbers into 1s and 2s compliment

    Addition of numbers in the 2s compliment

    Digital calculation Addition and subtraction in BCD and HEX forms Conversion of HEX numbers into 2s compliment form

  • Malaysian Institute of Aviation Technology

    Comprise of 10 digits from 0 to 9

    Base 10 system. Example 25410

    POSITIONAL VALUE SYSTEM

  • Malaysian Institute of Aviation Technology

    Example : 25410 consists of 2 HUNDREDS, 5 TENS and 4 ONE units.Written as : (2 X 100) + (5 X 10) + (4 X 1)

    = (2 X 102) + (5 X 101) + (4 X 100)

    Digit 2 carries the MOST weight and is known as MOST SIGNIFICANT DIGIT (MSD)

    Digit 4 carries the LEAST weight and is known as LEAST SIGNIFICANT DIGIT (LSD)

  • Malaysian Institute of Aviation Technology

    DISADVANTAGE for usage in digital computer example transistor due to :-Having 10 Discrete Value Level which is extremely difficult to operate due to:a. Any VARIATION of POWER SUPPLY would cause errorb. Component TOLERANCE MUST be ZEROc. Component VALUE will change with AGE

  • Malaysian Institute of Aviation Technology

    Comprise of 2 digits (0 & 1) known as BITS Base 2 system. Example : 10112 POSITIONAL value system

    10112=(1X23)+(0X22)+(1X21)+(1X20)

    BINARY to DECIMAL Conversion10112=(1X23)+(0X22)+(1X21)+(1X20)

    = 8+0+2+1= 11

  • Malaysian Institute of Aviation Technology

    DECIMAL to BINARY Conversioni)SUCCESSIVE POWER OF 2.

    Example: 27 =16+8+2+1 =24+23+21+20

    =(1x24)+(1x23)+(0X22)+(1X21)+(1X20) =110112

    ii)SUCCESSIVE divide by 2 and record any remainder of division.

    Suitable for SMALL number

  • Malaysian Institute of Aviation Technology

    Any number converted into BINARY form, the binary numbers is known as a WORD.

    Each word is formed of a numbers of BITS(BINARY DIGITS) and this represents the WORD LENGTH Example : 34710 = 1010110112. So 1010110112 is WORD. Word length is 9

    because there is 9bits

  • Malaysian Institute of Aviation Technology

    Base 8 systems Composed of 8 digits from 0 to 7 OCTAL to DECIMAL conversion

    Successive power of 8

    Example : 2758=(2x82)+(7x81)+(5x80)=128+56+5 = 18910

    DECIMAL to OCTAL conversion Divide by 8 and Record any REMAINDER of division

  • Malaysian Institute of Aviation Technology

    OCTAL to BINARY conversion- Convert each OCTAL number into 3 bits BINARY equivalent.

    Example : 6358 TO BINARY.6 3 5110 011 101

    Thus, 6358= 1100111012

  • Malaysian Institute of Aviation Technology

    BINARY to OCTAL conversion- Divide BINARY number into groups of 3 BITS starting from LSB.

    Example :1001110112 TO OCTAL.100 111 0114 7 3

    Thus, 1001110112=4738

    If the FINAL group of MSB does NOT have 3 BITS, ADD enough ZERO to make up 3 BITS.

  • Malaysian Institute of Aviation Technology

    BASE 16. Composed of 16 digit Symbols0 1 2 3 4 5 6 7 8 9 A B C D E F

    Example: 85D1B16 HEX to DECIMAL conversion

    - SUCCESSIVE POWER OF 16Example :B2F16=(11x162)+(2x161)+(15x160)

    =2816+32+15=286310

  • Malaysian Institute of Aviation Technology

    DECIMAL to HEX ConvertionDivide with 16 and take the REMAINDER of division

    HEX to BINARY ConversionConvert each HEX digit into 4 bits BINARY equivalent.i.e. B2F16 TO BINARY

    B 2 F1011 0010 1111

    THUS, B2F16= 1011001011112

  • Malaysian Institute of Aviation Technology

    BINARY to HEX Conversion- Divide BINARY number into groups of 4 bits STARTING at LSB.

    i.e. 1101101010012 TO HEX1101 1010 1001

    13 10 9D A 9

    Thus, 1101101010012=DA916

  • Malaysian Institute of Aviation Technology

    HEX to OCTAL Conversion and vice versai) Convert HEX to BINARY ii)Convert BINARY to OCTAL

    To Convert OCTAL to HEX, just REVERSE the processExample : 3D16 convert to OCTALi)Convert HEX to BINARY, 3 D

    0011 1101 3D16=1111012

    ii)Convert BINARY to OCTAL, 111 1017 5 1111012=758

    Thus, 3D16=758

  • Malaysian Institute of Aviation Technology

    Binary Coded Decimal Number represented in 4 bits binary code Leaving a space between each group of 4

    digits Example :

    a) 1110 to BCD is 0001 0001b) 1000 0101 in BCD to Decimal is 8510

  • Malaysian Institute of Aviation Technology

    Exercise:a) Convert from decimal to BCDi. 94ii. 529iii. 2947

    b) Convert from BCD to decimali. 011100001001ii. 001101100100

  • Malaysian Institute of Aviation Technology

    Rules :a) 0 + 0 = 0b) 0 + 1 = 1c) 1 + 0 = 1d) 1 + 1 = 0 with 1 to carry

    Example : 10112 + 11102 = 110012

  • Malaysian Institute of Aviation Technology

    Rules :a) 0 0 = 0b) 1 0 = 1c) 1 1 = 0d) 0 1 = 1 borrow 1

    Example : 110112 - 101012 =001102

  • Malaysian Institute of Aviation Technology

    Rulesa) 0 x 0 = 0b) 0 x 1 = 0c) 1 x 0 = 0d) 1 x 1 = 1 Example : 11002 x 112 = 1001002

    In computer, it is achieved by repeated addition. Ex:In decimal 2 x 4 is computed as 2+2+2+2 = 8

  • Malaysian Institute of Aviation Technology

    Rulesa) 1 1 = 1b) 0 1 = 0 Example : 1111002 1102 (60 6) = 10102

    (10)

    Computer CAN NOT divide. It divide by repeated subtraction

  • Malaysian Institute of Aviation Technology

    Computer need to distinguish between positive and negative numbers.

    For storage purpose, additional bit added to identify positive or negative

    0 for positive and 1 for negative

  • Malaysian Institute of Aviation Technology

    Example: Using 8 bit binary word, the sign bit is added on the front

    a) Decimal : - 10.25 Binary : 101010.010-ve sign

    b) Decimal : +10.25 Binary : 001010.010 +ve sign

  • Malaysian Institute of Aviation Technology

    Additional bit ONLY for storing numbers but DOES NOTallow direct subtraction of one number from another

    Use TWOs COMPLEMENT Process of inverting each bit in a word and adding 1

    Example : Find negative binary number of +510i) +5 as a 4 bit word 0 0101ii) Invert (change 0 to 1 & 1 to 0) 1 1010iii)Add 1 1iv)Answer 1 1011

  • Malaysian Institute of Aviation Technology

    When numbers are represented as NEGATIVE, subtraction is achieved by addition

    Adding a negative number is the SAME as subtracting a positive number

    Example : 5 7 = 5 + (-7)

  • Malaysian Institute of Aviation Technology

    5 7 = 5 + (-7) +7 = 00111= 00101 + 11001 Invert = 11000=11110 Add 1 = 11001= -2

    +2 = 00010Invert = 11101Add 1 = 11110

  • Malaysian Institute of Aviation Technology

    Conclusion Both addition and subtraction CAN be done

    by the SAME circuits in a computer which considerably REDUCES the hardwareinvolved

    LEARNING OUTCOME