L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................vbhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................vbhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh

Download L1- Number Systems jhkj njn bhagavad gita ...............................          hgjbhbjhbjhbjhjbbjbkj jhj hbjh                                  .........................................................bhagavad gita ...............................          hgjbhbjhbjhbjhjbbjbkj jhj hbjh                                  .........................................................bhagavad gita ...............................          hgjbhbjhbjhbjhjbbjbkj jhj hbjh                                  .........................................................vbhagavad gita ...............................          hgjbhbjhbjhbjhjbbjbkj jhj hbjh                                  .........................................................bhagavad gita ...............................          hgjbhbjhbjhbjhjbbjbkj jhj hbjh                                  .........................................................vbhagavad gita ...............................          hgjbhbjhbjhbjhjbbjbkj jhj hbjh

Post on 04-Jun-2018

216 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    1/32

    Microprocessors & Interfacing

    XX F241

    Number systemsKCS Murt i

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    2/32

    XX F241 MicroprocessorsKCS Murti

    Structure

    Number systems

    Decimal

    Binary

    Hexa Decimal

    Operations

    BCD Codes

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    3/32

    XX F241 MicroprocessorsKCS Murti

    Number Systems

    Decimal (0,1,2,3,4,5,6,7,8,9) Octal (0,1,2,3,4,5,6,7)

    Hexadecimal (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)

    Binary (0,1)

    A number anan-1a2a1a0a-1a-m expressed in base-rsystem, has coefficients multiplied by powers of r

    an.rn+an-1.r

    n-1+.+a2.r2+a1.r

    1+a0.r0+a-1.r

    -1+a-

    2.r-2+a-m.r-

    m

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    4/32

    XX F241 MicroprocessorsKCS Murti

    Convert to decimal

    (B65F)16= 11X 163 + 6X 162 +5X 161 +15= (46687)10

    (4021.2)5=4X 53+0 X 52+ 2X 51 +1 X 50 +2 X 51 = (511.4)10

    (1010.011)2= 23 + 21+ 2-2+ 2-3= (10.375)10

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    5/32

    XX F241 MicroprocessorsKCS Murti

    Binary Octal and Hexadecimal

    (10 1100 0110 1011 . 1111 0010 )2= (2C6B.F2)16

    (10 110 001 101 011 . 111 100 000 110)2= (26153.7460)8

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    6/32

    XX F241 MicroprocessorsKCS Murti

    Repeated division steps: Divide the decimal number by 2

    Write the remainder after eachdivision until a quotient of zero is

    obtained. The first remainder is the LSB

    and the last is the MSB

    Decimal to Binary

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    7/32

    XX F241 MicroprocessorsKCS Murti

    Decimal to binary..

    10

    Convert (153)10to Octal

    0

    5 0

    41

    20 1

    1 0

    2 1

    Ans=101001

    Integer ReminderConvert (41)10to binary

    2 3

    0 2

    153

    19 1

    Ans=(231)8

    0 1

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    8/32

    XX F241 MicroprocessorsKCS Murti

    Decimal to hexadecimal

    0 E

    227

    14 3

    Ans=0xE3H

    Integer ReminderConvert (227)10toHexadecimal

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    9/32

    XX F241 MicroprocessorsKCS Murti

    Decimal fractions to octal

    0.513 X 8= 4.104

    0.104 X 8= 0.832

    0.832 X 8= 6.656

    0.656 X 8= 5.2480.248 X 8= 1.984

    0.984 X 8= 7.872

    (0.513)10= (0.406517..)8

    Convert (0.513)10to octal

    4 0 6 5 1 7

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    10/32

    XX F241 MicroprocessorsKCS Murti

    Two types namely radix and diminished radix complement Diminished Radix or (r-1)s complement : For a number N

    with n digits,

    it is defined as (rn-1)-N

    Radix or rscomplement : For a number N with n digits, it

    is defined as

    (rn-1)-N+1

    Complements

    9s complement of 546700 is (999999-546700)=453299

    9s complement of 012398 is (999999-012398)=987601

    10s complement of 012398 is 987602

    10s complement of 246700 is 753300

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    11/32

    XX F241 MicroprocessorsKCS Murti

    1s and 2s complement

    1s complement of 1011000 is

    2s complement of 1101011 is

    0100111

    10100101s complement of 0101101 is

    0010101

    2s complement of 0110111 is 1001001

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    12/32

    XX F241 MicroprocessorsKCS Murti

    Signed Binary Numbers

    Signed magnitude of +7 00000111

    Signed magnitude of -7 10000111

    Represent +7 in 2s complement form

    Place 0 in sign bit 0

    Place magnitude in remaining 7 bits 00000111

    Represent -7 in 2s complement form

    Start with 8 bit code for +7 00000111

    Invert each bit including the MSB 11111000

    Add 1 11111001

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    13/32

    XX F241 MicroprocessorsKCS Murti

    Signed binary numbers

    Get the magnitude of -7

    Its 2s complement is 11111001

    MSB is 1. So magnitude is in 2s

    complement.Invert all bits including sign. 00000110

    Add 1 00000111

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    14/32

    XX F241 MicroprocessorsKCS Murti

    Range of numbers in 2s complement

    Signed binary Decimal

    01111111 +127

    ------

    00000001 +100000000 Zero

    11111111 -1

    -------

    10000001 -127

    10000000 -128

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    15/32

    XX F241 MicroprocessorsKCS Murti

    Addition

    +13 00001101

    +9 00001001

    +22 00100110

    +13 00001101

    -9 11110111

    +4 000001001

    Ignore carry

    +9 00001001

    -13 11110011

    -4 11111100

    -9 11110111

    -13 11110011

    -22 11101010

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    16/32

    XX F241 MicroprocessorsKCS Murti

    Hexa decimal addition

    7A 0111

    3F

    1010

    0011 1111

    B9 1011 1001

    7 A

    3 F

    1110 2510

    B16 916

    1 Carry

    B16 916

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    17/32

    XX F241 MicroprocessorsKCS Murti

    Overflow

    01110011

    11010001

    01000100

    115 115

    209 -47

    68 68

    Interpreted as

    unsigned binary

    (Incorrect)

    Interpreted as

    2s complement

    (correct)

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    18/32

    XX F241 MicroprocessorsKCS Murti

    Each decimal digit is represented using 4 bits. Ex: convert 87410to BCD:

    8 7 4

    0100 0111 0100 = 010001110100BCD

    Reverse the process to convert BCD to decimal

    BCD code

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    19/32

    XX F241 MicroprocessorsKCS Murti

    Advantages

    1. Ease of conversion

    2. Easy to design the logic circuit.

    3. Only the 4 bit groups for the decimal digits 0 to 9 need to

    be remembered.

    Disadvantages:

    1. BCD requires more bits

    BCD code..

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    20/32

    XX F241 MicroprocessorsKCS Murti

    Other binary codes

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    21/32

    XX F241 MicroprocessorsKCS Murti

    Binary Gray Code000 000001 001010 011011 010100 110101 111110 101111 100

    Grey code

    Only one bit changes between successive values

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    22/32

    XX F241 MicroprocessorsKCS Murti

    Gn = BnGn-1= Bn Bn-1

    Gn-2 = Bn-1 Bn-2

    ..

    ..

    G1 = B2 B1

    Binary to Grey code conversion

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    23/32

    Binary 1 0 0 1

    Gray 1 1 0 1

    Gray to Binary

    Gray 1 1 0 1

    Binary 1 0 0 1

    Example

    Binary to Gray

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    24/32

    XX F241 Microprocessors

    KCS Murti

    Grey codes

    Angular position Measurement where eachsegment is assigned a binary number

    Drive

    Load

    Shaft

    encoder

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    25/32

    XX F241 Microprocessors

    KCS Murti

    Shaft encoder

    Shaft Encoder

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    26/32

    Bytes : A byte is a string of eight bits.

    Nibble: A nibble is a string of four bits.

    Word : The word size can be defined as the

    number of bits in the binary word that a

    digital system operates on.

    i.e., it depends on the data pathway ofthe system.

    The byte, Nibble and Word

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    27/32

    XX F241 Microprocessors

    KCS Murti

    ASCII American Standard Code forInformation Interchange

    A binary code for letters, numerals, specialcharacters and control characters.

    Seven bit code: 27= 128 possible codegroups

    94 Graphic Characters and 34 non printing

    control characters

    Alphanumeric Code

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    28/32

    XX F241 Microprocessors

    KCS Murti

    Alphanumeric Code

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    29/32

    Parity:

    An extra bit (parity bit) is added to each word

    being transmitted.

    Even parity: P = 0 or 1 at Tx, such that no . of 1s

    in the code including parity bit is an

    evennumber.

    Odd Parity: P= 0 or 1 , such that no. 1s in thecode includingparity bit is an odd

    number.

    Error detection codes

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    30/32

    Let the code group is 1000001 (ASCII code forA),if evenparity is used, P=0.

    so, the new code 10000010

    ifodd parityis used, P=1

    so, the new code 10000011

    Where the last bit in the new code is parity bit (P)

    Example

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    31/32

    1. Position of error cannot be detected.2. Parity method would not work if two bits

    were in error.

    Limitations:

  • 8/13/2019 L1- Number Systems jhkj njn bhagavad gita ............................... hgjbhbjhbjhbjhjbbjbkj jhj hbjh .........................................................bhagavad gita ...........................

    32/32

    XX F241 MicroprocessorsKCS Murti