Computer Systems 1 Fundamentals of Computing - PowerPoint PPT Presentation

1 / 18
About This Presentation
Title:

Computer Systems 1 Fundamentals of Computing

Description:

Computer Systems 1 Fundamentals of Computing Data Representation Decimal, Binary, Hexadecimal Data Representation Decimal (Base 10) Binary (Base 2) Hexadecimal (Base ... – PowerPoint PPT presentation

Number of Views:98
Avg rating:3.0/5.0
Slides: 19
Provided by: glyndwrAc
Category:

less

Transcript and Presenter's Notes

Title: Computer Systems 1 Fundamentals of Computing


1
Computer Systems 1Fundamentals of Computing
  • Data RepresentationDecimal, Binary, Hexadecimal

2
Data Representation
  • Decimal (Base 10)
  • Binary (Base 2)
  • Hexadecimal (Base 16)

3
Decimal
  • Base 10
  • Numbers we use in everyday life
  • 10 values then increment to next digit position
    on left
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Each position represents a value of 10, to the
    positions power
  • Units (100), Tens (101), Hundreds (102), etc...
  • Ten fingers ten toes
  • Decimal numbers
  • E.g.-
  • 5
  • 64281
  • -3564

4
Binary
  • Base 2
  • Commonly used in computers to represent data
  • Used for all calculations and logic test results
  • 2 values, then increment next digit position on
    left
  • 0 or 1
  • Each position represents a value of 2 to the
    positions power
  • 20 (1), 21(2), 22 (4), 23 (8), 24 (16), etc
  • On or off (Digital)
  • Binary numbers
  • E.g.-
  • 01
  • 1010110
  • 00000000
  • 11111111

5
Binary Bits n Bytes
  • A bit is a single binary digit (1 or 0)
  • A kilobit (KB) is 1024 bits
  • A byte is eight bits
  • Four bits are sometimes called a nibble
  • A kilobyte (Kb) is 1024 bytes
  • A megabyte (Mb) is 1024 kilobytes
  • A gigabyte (Gb) is 1024 megabytes
  • A terabyte (Tb) is 1024 gigabytes

6
Padding, Cladding and Loft Insulation (?!?)
  • Often when writing binary values we will use a
    notation method called padding
  • This involves padding a value with zeros on the
    left up to the nearest byte size
  • Extra zeros become insignificant
  • Makes reading and working with values easier
  • The first 1 encountered on the left is most
    significant bit (MSB)
  • The last 1 on the furthest right is least
    significant bit (LSB)
  • Example
  • Binary number 1011
  • Padded to a byte 00001011
  • Binary 010
  • Padded to a byte 00000010
  • This could have originally been just 10 too!

7
Converting Decimal Binary
  • To convert decimal to binary
  • If the decimal number is ODD, write a 1 on the
    far right hand side
  • OR if the decimal number is EVEN, write a 0 on
    the far right hand side
  • Divide the decimal number by TWO
  • If there is a remainder then ignore it
  • If the number you have is ODD, write a 1 to the
    left of the previous digit
  • OR if the number is EVEN, write a 0 to the left
    of the previous digit
  • Repeat until your decimal number is 0

8
Converting Decimal Binary
  • Decimal 15 ODD 1
  • 15/2 7.5 7 ODD 11
  • 7/2 3.5 3 ODD 111
  • 3/2 1.5 1 ODD 1111
  • Binary 1111 Decimal 15 !!!!
  • We can pad our binary number with 0s
  • Eg 00001111
  • Decimal 32 EVEN 0
  • 32/2 16 EVEN 00
  • 16/2 8 EVEN 000
  • 8/2 4 EVEN 0000
  • 4/2 2 EVEN 00000
  • 2/2 1 ODD 100000
  • Binary 100000 Decimal 32 !!!!
  • We can pad our binary number with 0s
  • Eg 00100000

9
Converting Binary Decimal
  • To convert binary to decimal
  • Write out the binary number
  • Add the positional values to each digit
  • Where there is a 1 below the positional value
    highlight that positional value
  • Once all 1s in the binary number have
    highlighted their positional values
  • Add all highlighted values together
  • Positional values
  • 512 256 128 64 32 16 8
    4 2 1
  • These values can of course increase
  • Doubled with each positional move left

10
Converting Binary Decimal
  • E.g.-
  • Binary number 00011011
  • Add positional values
  • 128 64 32 16 8 4 2 1
  • 0 0 0 1 1 0 1
    1
  • Highlight the positional values
  • Add the highlighted values together
  • 16821 27
  • So Binary 00011011 Decimal 27 !!

11
Hexadecimal
  • Base 16
  • Another common format for data representation
  • Easy to map against binary
  • Used to easily represent large numbers
  • Common usage is memory locations
  • 16 values then increment next digit on left
    position
  • 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
  • Each position represents a value of 16 to the
    positions power
  • 160 (1), 161 (16), 162 (256), 163 (4096), 164
    (65536), etc
  • Hexadecimal numbers
  • E.g-
  • 5
  • 10
  • FF
  • FB 19

12
Hexadecimal Values
DECIMAL
HEXADECIMAL
13
Converting Decimal Hexadecimal
  • To convert decimal to hexadecimal
  • Write out the decimal number
  • Write out the hexadecimal positional values
  • Find the largest hex positional value that your
    decimal number will divide into
  • Divide your decimal number by that hex positional
    value
  • Take the answer( ignore the remainder) and add it
    to the left hand side of your hex answer multiply
    this number by its positional value and then
    subtract it from your decimal number
  • Take whats left of your decimal number and
    repeat the process until you have nothing left
  • We can also pad out Hex values with zeros if we
    want too!

14
Converting Decimal Hexadecimal
  • E.g.-
  • Decimal 280
  • Write Hex positional values
  • 1048576 65536 4096 256 16 1
  • Divide 280 by 256 (1)
  • Multiply 1 by 256 (256)
  • Subtract 256 from 280 (280-25624)
  • Divide 24 by 16(1)
  • Multiply 1 by 16 (16)
  • Subtract 16 from 24 (24-168)
  • Divide 8 by 1 (8)
  • Write in the 8
  • 1048576 65536 4096 256 16 1
  • 0 0 0 1
    1 8
  • Hex number 118

15
Converting Hexadecimal Decimal
  • To convert hexadecimal to decimal
  • Write out the hexadecimal number
  • Add the positional values to each digit
  • Where there is a value greater than 0 below the
    positional value highlight that positional value
  • Once all positional values have been highlighted,
    multiply the number below, by its positional
    value
  • Add all results of highlighted values together
  • Positional values
  • 1048576 65536 4096 256 16 1
  • These values can of course increase to the power
    of 16

16
Converting Hexadecimal Decimal
  • E.g.-
  • Hex number 4C
  • Add positional values
  • 1048576 65536 4096 256 16 1
  • 0 0 0 0 4
    C
  • Highlight positional values
  • Multiply positional values by the number below
  • 416 64
  • C1 121 12
  • Add these together
  • 641276

17
Notation of Numerical Values
  • Very often we will have to write many different
    base value numbers
  • Performing calculations or comparisons
  • For easy reading, the following conventions are
    used
  • Decimal
  • Will either appear with no special notation or
    with a subscript 10 after the number
  • e.g.- 365 or 36510
  • Binary
  • Using subscript 2 after the number
  • e.g.- 100111012
  • Hexadecimal
  • Using a subscript 16 after the number, of a
    prefix 0x
  • e.g.- 4D16 or 0x4D

18
CS1 Week 3
  • What you know now
  • Decimal principles
  • Binary
  • Method
  • Notation
  • Bits, bytes, etc.
  • Conversion
  • Hexadecimal
  • Method
  • Notation
  • Conversion
Write a Comment
User Comments (0)
About PowerShow.com