Introduction to Number Representation


Binary Coded Decimal (BCD)


Download 0.98 Mb.
bet2/2
Sana09.01.2022
Hajmi0.98 Mb.
#261703
1   2
Bog'liq
Binary ALevelComputerScience

Binary Coded Decimal (BCD)

  • BCD represents denary integers using blocks of four binary digits.
  • Each block of four is converted and the denary values are then read off:
  • Therefore 1001 0011 1000 in BCD = 938 in denary.
  • 8
  • 4
  • 2
  • 1
  • 1
  • 0
  • 0
  • 1
  • 8 + 0 + 0 + 1
  • 9
  • 8
  • 4
  • 2
  • 1
  • 0
  • 0
  • 1
  • 1
  • 0 + 0 + 2 + 1
  • 3
  • 8
  • 4
  • 2
  • 1
  • 1
  • 0
  • 0
  • 0
  • 8 + 0 + 0 + 0
  • 8

Uses of BCD

  • BCD enables fast conversions from denary to binary for applications such as pocket calculators.
  • Each digit on a calculator corresponds directly to a four-bit block in BCD.

Storing Negative Integers

  • 1 method is Sign/Magnitude
  • 64
  • 32
  • 16
  • 8
  • 4
  • 2
  • 1
  • 128
  • +/-
  • MSB
  • 0
  • 1
  • 0
  • 0
  • 1
  • 0
  • 1
  • 1
  • 75
  • -75
  • 1

Sign/Magnitude

  • This method has some limitations
  • Makes calculations difficult by losing 1 bit
  • 64
  • 32
  • 16
  • 8
  • 4
  • 2
  • 1
  • +/-
  • 0
  • 1
  • 0
  • 0
  • 1
  • 0
  • 1
  • 1
  • Sign
  • Value or Magnitude

Storing Negative Integers

  • 64
  • 32
  • 16
  • 8
  • 4
  • 2
  • 1
  • 128
  • -128
  • 1
  • 0
  • 1
  • 1
  • 0
  • 1
  • 0
  • 1
  • -75
  • -128+32+16+4+1=-75

2s Complement Conversion

  • -117
  • Stage 1 : work out 117 in binary
  • -128
  • 64
  • 32
  • 16
  • 8
  • 4
  • 2
  • 1
  • 1
  • 0
  • 0
  • 0
  • 1
  • 0
  • 1
  • Stage 2 : Reverse the 0’s and 1’s
  • 128
  • 64
  • 32
  • 16
  • 8
  • 4
  • 2
  • 1
  • 0
  • 1
  • 1
  • 1
  • 0
  • 1
  • 0
  • 1
  • Stage 3 : Plus 1
  • 1
  • 0

Representing characters

  • There are three main coding systems that provide conversions of keyboard characters into binary:
    • EBCDIC
    • ASCII
    • UNICODE

EBCDIC

  • EBCDIC stands for Extended Binary Coded Decimal Interchange Code.
  • It is an extension of BCD which includes non-numeric characters, including all the keyboard characters and special characters.
  • It is commonly used to encode data onto magnetic tape.

ASCII

  • ASCII stands for the American Standard Code for Information Interchange.
  • It has been adopted as the industry-standard way of representing keyboard characters as binary codes.
  • Every keyboard character is given a corresponding binary code.
  • ASCII uses an 8-bit code to provide 256 characters.

UNICODE

  • UNICODE is the new standard to emerge that is replacing ASCII.
  • It has been adopted by many of the big businesses in the computing industry.
  • It is designed to cover more of the characters that are found in languages across the world.
  • It has become important due to the increased use of the Internet, as more data is being passed around globally.

Download 0.98 Mb.

Do'stlaringiz bilan baham:
1   2




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling