KEMBAR78
CCS103 Bits, Bytes, Binary | PPTX
S
CSC 103
Bits & Bytes
The Language of Computers
Bits & Bytes
 Data on a computer is represented
(and stored) as bits and bytes
 Data can be translated to display
text, numbers and pixels
Binary Language
 The language of computers is binary.
 Uses series of 1’s and 0’s –
which represent on/off state.
 Used for giving instructions
 Also used for measuring quantity
(file size/storage)
Quick History of Binary
 Morse Code (in 1844) was sent with
electrical impulses over a wire which
translated to dots and dashes (a form of
binary code) to create messages
heard by the human ear.
 Evolved into telegraph/telegram messages.
Binary Digit (Bit)
 1’s and 0’s are binary digits
 Bit is short for binary digit
 1 bit can only be 1 or 0…
so it is expanded to 8 bits
or 1 byte (28) which allows
for 256 combinations
of 1’s and 0’s
Binary Combinations
Combinations will continue to double
512, 1024, 2048…
1 Byte = 8 Bit
 8 bits or 1 Byte represents enough
numbers to convert to ASCII letters
(or characters) of the alphabet.
 For example:
The character “k” in binary is 01101011
- referenced by the number 107.
-- see chart on next slide --
ASCII to Binary
Bits translated to Numbers
 Binary can represent numbers
higher than 0 and 1.
 Instead of 1’s, 10’s, 100’s, 1000’s etc.,
like our base 10 number system,
it uses binary or base 2.
 It uses 1’s, 2’s, 4’s, 8’s, 16’s, 32’s, 64’s, etc.
(starting from right (1’s) to left)
Bits converted to Numbers
4-bit example
1 0 1 1
8’s 4’s 2’s 1’s
8 + 0 + 2 + 1
8 + 3 + 1 = 11
Bits converted to Numbers
4-bit example
1 1 1 1
8’s 4’s 2’s 1’s
8 + 4 + 2 + 1
8 + 4 + 2 + 1 = 15
Bits converted to Numbers
4-bit example
1 0 1 0
8’s 4’s 2’s 1’s
8 + 0 + 2 + 0
Bits converted to Numbers
4-bit example
__ __ __ __
8’s 4’s 2’s 1’s
What binary number = 9
Bits converted to Numbers
4-bit example
1 0 0 1
8’s 4’s 2’s 1’s
8 + 0 + 0 + 1 = 9
Bits converted to Numbers
8-bit example
1 0 1 0
8’s 4’s 2’s 1’s
128 + 0 + 32 + 0 + 8 + 0 + 2 + 0
160 + 10 = 170
1 0 1 0
128’s 64’s 32’s 16’s
Bits converted to Numbers
8-bit example
1 1 1 1
8’s 4’s 2’s 1’s
128 + 64 + 32 + 16 + 8 + 4 + 2 + 1
240 + 15 = 255
1 1 1 1
128’s 64’s 32’s 16’s
Shortcut to Count 8-bit
Count each side up to 15
1 1 1 1
8’s 4’s 2’s 1’s
8 + 4 + 2 + 1 8 + 4 + 2 + 1
240 + 15 = 255
1 1 1 1
128’s 64’s 32’s 16’s
15 * (1)15 * (16)
Shortcut to Count 8-bit
Count each side up to 15
0 1 1 1
8’s 4’s 2’s 1’s
8 + 0 + 0 + 1 + 0 + 4 + 2 + 1
240 + 15 = 255
1 0 0 1
__ * (1)__ * (16)
8’s 4’s 2’s 1’s
Shortcut to Count 8-bit
Count each side up to 15
0 1 1 1
8’s 4’s 2’s 1’s
8 + 0 + 0 + 1 + 0 + 4 + 2 + 1
151 + 7 = 158
1 0 0 1
7 * (1)9 * (16)
8’s 4’s 2’s 1’s
Shortcut to Count 8-bit
What binary number is 160?
0 0 0 0
8’s 4’s 2’s 1’s
0 + 0 + 0 + 0 + 0 + 0 + 0 + 0
0 + 0 = 0
0 0 0 0
__ * (1)__ * (16)
8’s 4’s 2’s 1’s
Shortcut to Count 8-bit
What binary number is 160?
160 / 16 = _____
Remainder is the 1’s ________
__ * (1)__ * (16)
Shortcut to Count 8-bit
What binary number is 160?
160 / 16 = 10
Remainder is the 1’s: 0
0 * (1)10 * (16)
Shortcut to Count 8-bit
What binary number is 160?
0 0 0 0
8’s 4’s 2’s 1’s
8 + 0 + 2 + 0 + 0 + 0 + 0 + 0
160 + 0 = 160
1 0 1 0
0 * (1)10 * (16)
8’s 4’s 2’s 1’s
Shortcut to Count 8-bit
This is essentially the Hexadecimal System
0 0 0 0
8’s 4’s 2’s 1’s
8 + 0 + 2 + 0 + 0 + 0 + 0 + 0
160 + 0 = 160
1 0 1 0
0 * (1)10 * (16)
8’s 4’s 2’s 1’s
RGB Color translated to
Hexadecimal Color
 Hexadecimal Color is used to
describe RGB color on web pages.
For Example:
 RGB: 255 255 255
(white – highest number)
 Hex: #FF FF FF or #FFF
Hexadecimal Color
(Base 16)
 0123456789ABCDEF describes numbers
0-15 (10 is A, 11 is B, etc.)
 The first number is the number of 16’s,
the second number is the 1’s
 So, RGB number 51 would be…
 (3) 16s = 48 : first number is 3
+ (3) 1s = 3 : second number is 3
Hex = #33
So instead of…
255
Hundreds Tens Ones
Hex uses…
FF
Sixteens Ones
Hexadecimal System
(Base 16)
So, in the case of…
255
15 x 16’s = 240
15 x 1’s = 15
15 = F
15 = F
or FF240 + 15 = 255
Hexadecimal System
(Base 16)
Hexadecimal Color
(Base 16)
 What is the hexadecimal
equivalent of the RGB number
36 100 74 ?
 #___ ____ ____ ____ ____ ____
 Remember: find how many 16s and
then how many 1’s for each number.
Use letters A-F in place of 10-15.
Credits
 www.mathisfun.com
 introcomputing.org
 sticksandstones.kstrom.com
 e-tutes.com
 Richard Homa ©2019

CCS103 Bits, Bytes, Binary

  • 1.
    S CSC 103 Bits &Bytes The Language of Computers
  • 2.
    Bits & Bytes Data on a computer is represented (and stored) as bits and bytes  Data can be translated to display text, numbers and pixels
  • 3.
    Binary Language  Thelanguage of computers is binary.  Uses series of 1’s and 0’s – which represent on/off state.  Used for giving instructions  Also used for measuring quantity (file size/storage)
  • 4.
    Quick History ofBinary  Morse Code (in 1844) was sent with electrical impulses over a wire which translated to dots and dashes (a form of binary code) to create messages heard by the human ear.  Evolved into telegraph/telegram messages.
  • 5.
    Binary Digit (Bit) 1’s and 0’s are binary digits  Bit is short for binary digit  1 bit can only be 1 or 0… so it is expanded to 8 bits or 1 byte (28) which allows for 256 combinations of 1’s and 0’s
  • 6.
    Binary Combinations Combinations willcontinue to double 512, 1024, 2048…
  • 7.
    1 Byte =8 Bit  8 bits or 1 Byte represents enough numbers to convert to ASCII letters (or characters) of the alphabet.  For example: The character “k” in binary is 01101011 - referenced by the number 107. -- see chart on next slide --
  • 8.
  • 9.
    Bits translated toNumbers  Binary can represent numbers higher than 0 and 1.  Instead of 1’s, 10’s, 100’s, 1000’s etc., like our base 10 number system, it uses binary or base 2.  It uses 1’s, 2’s, 4’s, 8’s, 16’s, 32’s, 64’s, etc. (starting from right (1’s) to left)
  • 10.
    Bits converted toNumbers 4-bit example 1 0 1 1 8’s 4’s 2’s 1’s 8 + 0 + 2 + 1 8 + 3 + 1 = 11
  • 11.
    Bits converted toNumbers 4-bit example 1 1 1 1 8’s 4’s 2’s 1’s 8 + 4 + 2 + 1 8 + 4 + 2 + 1 = 15
  • 12.
    Bits converted toNumbers 4-bit example 1 0 1 0 8’s 4’s 2’s 1’s 8 + 0 + 2 + 0
  • 13.
    Bits converted toNumbers 4-bit example __ __ __ __ 8’s 4’s 2’s 1’s What binary number = 9
  • 14.
    Bits converted toNumbers 4-bit example 1 0 0 1 8’s 4’s 2’s 1’s 8 + 0 + 0 + 1 = 9
  • 15.
    Bits converted toNumbers 8-bit example 1 0 1 0 8’s 4’s 2’s 1’s 128 + 0 + 32 + 0 + 8 + 0 + 2 + 0 160 + 10 = 170 1 0 1 0 128’s 64’s 32’s 16’s
  • 16.
    Bits converted toNumbers 8-bit example 1 1 1 1 8’s 4’s 2’s 1’s 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 240 + 15 = 255 1 1 1 1 128’s 64’s 32’s 16’s
  • 17.
    Shortcut to Count8-bit Count each side up to 15 1 1 1 1 8’s 4’s 2’s 1’s 8 + 4 + 2 + 1 8 + 4 + 2 + 1 240 + 15 = 255 1 1 1 1 128’s 64’s 32’s 16’s 15 * (1)15 * (16)
  • 18.
    Shortcut to Count8-bit Count each side up to 15 0 1 1 1 8’s 4’s 2’s 1’s 8 + 0 + 0 + 1 + 0 + 4 + 2 + 1 240 + 15 = 255 1 0 0 1 __ * (1)__ * (16) 8’s 4’s 2’s 1’s
  • 19.
    Shortcut to Count8-bit Count each side up to 15 0 1 1 1 8’s 4’s 2’s 1’s 8 + 0 + 0 + 1 + 0 + 4 + 2 + 1 151 + 7 = 158 1 0 0 1 7 * (1)9 * (16) 8’s 4’s 2’s 1’s
  • 20.
    Shortcut to Count8-bit What binary number is 160? 0 0 0 0 8’s 4’s 2’s 1’s 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 0 + 0 = 0 0 0 0 0 __ * (1)__ * (16) 8’s 4’s 2’s 1’s
  • 21.
    Shortcut to Count8-bit What binary number is 160? 160 / 16 = _____ Remainder is the 1’s ________ __ * (1)__ * (16)
  • 22.
    Shortcut to Count8-bit What binary number is 160? 160 / 16 = 10 Remainder is the 1’s: 0 0 * (1)10 * (16)
  • 23.
    Shortcut to Count8-bit What binary number is 160? 0 0 0 0 8’s 4’s 2’s 1’s 8 + 0 + 2 + 0 + 0 + 0 + 0 + 0 160 + 0 = 160 1 0 1 0 0 * (1)10 * (16) 8’s 4’s 2’s 1’s
  • 24.
    Shortcut to Count8-bit This is essentially the Hexadecimal System 0 0 0 0 8’s 4’s 2’s 1’s 8 + 0 + 2 + 0 + 0 + 0 + 0 + 0 160 + 0 = 160 1 0 1 0 0 * (1)10 * (16) 8’s 4’s 2’s 1’s
  • 25.
    RGB Color translatedto Hexadecimal Color  Hexadecimal Color is used to describe RGB color on web pages. For Example:  RGB: 255 255 255 (white – highest number)  Hex: #FF FF FF or #FFF
  • 26.
    Hexadecimal Color (Base 16) 0123456789ABCDEF describes numbers 0-15 (10 is A, 11 is B, etc.)  The first number is the number of 16’s, the second number is the 1’s  So, RGB number 51 would be…  (3) 16s = 48 : first number is 3 + (3) 1s = 3 : second number is 3 Hex = #33
  • 27.
    So instead of… 255 HundredsTens Ones Hex uses… FF Sixteens Ones Hexadecimal System (Base 16)
  • 28.
    So, in thecase of… 255 15 x 16’s = 240 15 x 1’s = 15 15 = F 15 = F or FF240 + 15 = 255 Hexadecimal System (Base 16)
  • 29.
    Hexadecimal Color (Base 16) What is the hexadecimal equivalent of the RGB number 36 100 74 ?  #___ ____ ____ ____ ____ ____  Remember: find how many 16s and then how many 1’s for each number. Use letters A-F in place of 10-15.
  • 30.
    Credits  www.mathisfun.com  introcomputing.org sticksandstones.kstrom.com  e-tutes.com  Richard Homa ©2019