0% found this document useful (0 votes)
84 views

Lesson 2 Everything Binary: Bits Basic Concepts and How Are Bits Used To Represent Information

The document discusses binary concepts and how bits are used to represent information. Some key points: - Bits have two possible values, 0 or 1, and more bits can encode more information but require more storage space. - Common prefixes like mega, giga, tera are used to indicate sizes of bits and bytes in computer storage. - Binary notation uses combinations of 0s and 1s to represent values, in contrast to decimal which uses 0-9. Methods to convert between binary and decimal are presented. - ASCII encoding represents text characters as 8-bit binary values, allowing 256 possible characters to be encoded. - Bits are also used to represent digital media like images, sound, and program

Uploaded by

Emily Chu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
84 views

Lesson 2 Everything Binary: Bits Basic Concepts and How Are Bits Used To Represent Information

The document discusses binary concepts and how bits are used to represent information. Some key points: - Bits have two possible values, 0 or 1, and more bits can encode more information but require more storage space. - Common prefixes like mega, giga, tera are used to indicate sizes of bits and bytes in computer storage. - Binary notation uses combinations of 0s and 1s to represent values, in contrast to decimal which uses 0-9. Methods to convert between binary and decimal are presented. - ASCII encoding represents text characters as 8-bit binary values, allowing 256 possible characters to be encoded. - Bits are also used to represent digital media like images, sound, and program

Uploaded by

Emily Chu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

5/25/20

Lesson 2
Everything Binary
Bits basic concepts and how are bits used to
represent information

Bits

• In computer systems, data is stored and represented


in binary digits, called bits.
• A bit has two possible values, 0 or 1.
• How many possible values with two bits?
• How many possible values with three bits?
• Do you see a pattern?

Number of Possible Values

• n bits can represent 2n different things;


• More bits can encode more information;
• More bits require more computer storage for each
thing encoded;
• 1 byte (= 8 bits) is the smallest storage unit used on
modern computer;

1
5/25/20

So Many Bits and Bytes...

• The number of bits to encode information especially


for digital media are very large.
• We use prefixes, such as mega and giga, to better
conceive the number of bits and bytes of computer
storage.

Prefixes
Prefix Name Abbreviation Size
Kilo K 210 = 1,024
Mega M 220 = 1,048,576
Giga G 230 = 1,073,741,824
Tera T 240 = 1,099,511,627,776
Peta P 250 =
1,125,899,906,842,624

Note the size is computed by the exponential of 2.


The exponent is increased in a step of 10,
i.e. 210 , 220 , 230 , 240 , 250 , ...

It is NOT 103 , 106 , 109 , 1012 , 1015 , ...


5

To Understand Binary Numbers, We Need to


Understand Decimal Notation (Base-10)

• Commonly used in our daily life


• Use combinations of 10 different numerals to
construct any values
• The 10 different numerals are:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9

2
5/25/20

Base-10 Example

The decimal number 5872 is interpreted as follows.

5 0 0 0
8 0 0
7 0
+ 2
5 8 7 2

Base-10 Example
In other words,

5 8 7 2

= 5 x 103 + 8 x 102 + 7 x 101 + 2 x 100


= 5 x 1000 + 8 x 100 + 7 x 10 + 2 x 1
= 5 000 + 8 00 + 70 + 2
= 5872
8

Binary Notation
Base-2
• Used in machine language (language that computers
understand);
• Use combinations of 2 different numerals to
construct any values;
• The 2different numerals are 0 and 1.

3
5/25/20

Base-2 Example
The binary notation 1011 is interpreted as follows.

1 0 1 1

= 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20
= 1 x8 + 0 x4 + 1 x2 + 1 x1
= 8 + 0 + 2 + 1
= 11 (eleven, in decimal notation)
10

Base-2 to Base-10

• The previous slide shows the base-2 to base-10


conversion method.
• 10112 (one one zero one) represents 1110 (eleven).
• The subscript indicates the base.
• A video tutorial:
https://www.youtube.com/watch?v=lnC7h6fgglU

11

Base-10 to Base-2

To convert base-10 to base-2 notation:


1. repeatedly divide the decimal number by 2 until it
becomes 0, noting the remainder of each division.
2. The reverse order of the sequence of the
remainders is the binary representation of the
decimal number.

12

4
5/25/20

Base-10 to Base-2 Example

To convert 1910 to binary notation:


19 / 2 = 9 remainder 1
9 / 2 = 4 remainder 1
4 / 2 = 2 remainder 0 100112
2 / 2 = 1 remainder 0
1 / 2 = 0 remainder 1

13

Decimal to Binary Conversion

• A complete video tutorial:


https://www.youtube.com/watch?v=rsxT4FfRBaM

14

Use Binary for Text: ASCII

• ASCII stands for American Standard Code for


Information Interchange
• By assigning unique numbers to each text character;
• An encoding standard for text characters, including
the 26-letter English alphabets and symbols in
computer programs.

15

5
5/25/20

ASCII

• For ASCII character set, each character uses 8 bits.


• With 8 bits, you can encode 28 = 256 different
characters.
• http://www.theasciicode.com.ar/ shows the entire
ASCII table, which contains 256 different characters.

16

For example, the character A is represented by 65.

http://www.theasciicode.com.ar/

Binary to Letter

• 65 in binary is 1000001 which contains 7 bits, we add


0 to the beginning to make it: 01000001, which
contains 8 bits (1 byte).

• Activity assignment (see assignment).

18

6
5/25/20

Using bits to represent images

• Bitmap images, such as digital photos


– color value of each pixel encoded into bits
• Vector graphics, such as graphics created in Flash
– coordinates of anchor points encoded into bits
– tangent of each anchor points encoded into bits
• Bitmap images, vector graphics, and pixels will be
explained in the digital images chapters
19

Using bits to represent sound


• sampled audio
– amplitude for each sample encoded into bits
For CD quality audio, it has 44,100 samples per second of the
audio
• MIDI music
– each musical instrument has an ID which can be encoded into
bits
– each musical note has an ID which can be encoded into bits
• Sampled audio and MIDI will be explained in the audio
chapters
20

Using bits to represent program


instructions
For example, an arithmetic addition may be represented
by a sequence of bits:
001100

21

7
5/25/20

File Sizes

• In a text document that uses ASCII code to


represent text characters, each byte stores an ASCII
code that corresponds to a character.
• The more characters in a text document, the more
bytes are required to store the file.
• Digital media files (image, sound, and especially
video files) can be very large.

22

Disadvantages of Large File Size

• take more storage


• take longer to send the file over the Internet
• take longer to process (such as during opening and
saving) the file

23

Strategies to Reduce Digital Media


File Size
• Reduce the sampling rate
• Reduce the bit depth
• Apply file compression
• There are lossy vs. lossless compression;
• Lossy compression: information lost during compression
to reduce file size;
• Lossless compression: information reorganized and
restructured to reduce file size, but no information is lost.
24

You might also like