Professional Documents
Culture Documents
1 Binary systems
In mathematics and digital electronics, a binary number is a number expressed in
the binary numeral system, or base-2 numeral system, which represents numeric
values using two different symbols: typically 0 (zero) and 1 (one). More
specifically, the usual base-2 system is a positional notation with a radix of 2.
Because of its straightforward implementation in digital electronic
circuitry using logic gates, the binary system is used internally by almost all
modern computers and computer-based devices such as mobile phones. Each digit
is referred to as a bit.
Calculating binary numbers
Likewise, when working with binary numbers, the position is important in order for
you to be able to calculate the correct value.
The value 1 in binary represents the value one, the value 0 represents zero.
For base-two binary numbers, you need to multiply each digit on the left by a
progressive factor of 2. As with denary numbers, the calculations always work from
right to left.
in
sa
Example 1: Denary = 1
us
H
128 64 32 16 8 4 2 1
0 0 0 0 0 0 0 1
q a
ht
(1 * 1) = 1
-M
M
Example 2: Denary = 3
128 64 32 16 8 4 2 1
0 0 0 0 0 0 1 1
(1 * 1) + (2 * 1) = 3
128 64 32 16 8 4 2 1
0 0 0 0 0 1 1 0
(1 * 0) + (2 * 1) + ( 4 * 1) = 6
Example 4: Denary = 12
128 64 32 16 8 4 2 1
0 0 0 0 1 1 0 0
in
Answer: Binary = 00001100
sa
(1 * 0) + (2 * 0) + (4 * 1) + (8 * 1) = 12
us
H
Example 5: Denary = 37
a q
128 64 32 16 8 4 2 1
ht
0 0 1 0 0 1 0 1
us
(1 * 1) + (2 * 0) + (4 * 1) + (8 * 0) + (16 * 0) + (32 * 1) = 37
M
128 64 32 16 8 4 2 1
0 1 1 1 0 0 1 1
128 64 32 16 8 4 2 1
1 1 1 1 1 1 1 1
if the digit is a 0 then just don't add that value to the total. The number below has a 0 in the 32
position and the binary number in decimal is:
11011111
1x128 + 1x64 + 0x32 + 1x16 + 1x8 + 1x4 + 1x2 + 1x1 = 223 decimal
in
Let's try a smaller binary number:
sa
What is 10101 in decimal?
Answer: us
H
10101
q
1x16 + 0x8 + 1x4 + 0x2 + 1x1 = 21 decimal
a
ht
us
-M
M
A 'bit' (short for Binary Digit) is the smallest unit of data that can be stored by a computer. Each
'bit' is represented as a binary number, either 1 (true) or 0 (false).
Byte
A single keyboard character that you type, such as the letter A or the letter T takes up one byte of
storage.
Nibble
This is not a very commonly used term compared to bit and byte. It is the term given to a group
of four bits. Therefore two nibbles make a byte.
The reason it is not very common is because most microprocessors use groups of 8 bits and
in
higher i.e. they use one or more bytes to process data. Not many devices make use of a nibble.
sa
Kilobyte
us
H
a q
ht
us
-M
M
in
So a simple, limited colour image as seen on the left will take up much less storage than the
sa
detailed (but cute) image on the right.
Megabyte
us
H
A megabyte is a unit of storage capacity. It can be written as MB or mbyte.
a q
PowerPoint presentations on the other hand can be quite large. For example, a ten slide
presentation with an image on each slide and a theme applied to the slide backgrounds could be 2
-M
or 3 megabytes in size.
M
. Gigabyte
A Gigabyte is equivalent to 1024 Megabytes although you will commonly see it referred to as
1,000 Megabytes (which isn't correct).
1 Gigabyte could hold the contents of about 10 yards of books on a book shelf.
A DVD can store a Hollywood blockbuster film which would be around 4-8 gigabytes in size.
Hard disks are measured in gigabytes, with a typical hard disk size being around 160 gigabytes
or more.
A terabyte is equivalent to 1024 Gigabytes although you will commonly see it referred to as
1,000 Gigabytes (which isn't correct).
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
in
The decimal numbers 10 to 15 are represented with the letters A to F. There are 16 values, hence
why it is a base-16 number system.
sa
Hexadecimal is widely used in computing because it is a much shorter way of representing a byte
us
of data. If we were to represent a byte of data in binary, it would require 8 digits, e.g. 11111111.
H
However, that same byte of data could be represented in hexadecimal in just two digits e.g. FF -
much more compact and user friendly than a binary number.
a q
ht
The table above only shows hexadecimal numbers up to denary 15. The largest byte value is 255
and you can use hexadecimal numbers to represent up to this value.
us
We can extend the table above to show the next set of hexadecimal numbers:
-M
Decimal 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
M
Hexadecimal 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F
Once we have gone past the first 16 numbers, a 1 is added in front of the next 16 numbers
(similar to denary when we go from 0-9 and then the next 10 numbers have a 1 in front of them)
Decimal 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
Hexadecimal 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F
See if you can complete the table for the next set:
Decimal 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
Hexadecimal
in
Now we add all of the numbers together to get the DEC number for HEX number
sa
1E5DF:
15 + 208 + 1280 + 57344 + 65536 = 124383
us
H
Hexa to binary
a q
Example #1
ht
(E)16 = (1110)2
-M
So
(4E)16 = (01001110)2
M
Example #2
Convert (4A01)16 to binary:
(4)16 = (0100)2
(A)16 = (1010)2
(0)16 = (0000)2
(1)16 = (0001)2
So
(4A01)16 = (0100101000000001)2
Here are two important aspects to the beauty of using Hexadecimal with
computers: First, it can represent 16-bit words in only four Hex digits, or 8-
bit bytes in just two; thus, by using a numeration with more symbols, it is
both easier to work with (saving paper and screen space) and makes it
possible to understand. This is why programs such as DEBUG, use only
Hexadecimal to display the actual Binary bytes of a Memory Dump rather
than a huge number of ones and zeros!
in
two hexadecimal digits to create 255 possible values, thus resulting in more
than 16 million possible colors. For example, the HTML (hypertext markup
sa
language) code telling a browser to render the background color of a web
us
page as red is <body bgcolor="#FF0000"> and that telling it to render the
page as white is <body bgcolor="#FFFFFF">.
H
MAC addresses consist of hex values, and a Media Access Control (MAC)
q
Af-14-b3-c2-14-45
us
The first oddity with MAC addresses is that we've got numbers and letters in
-M
the address. Since every single networking device should have a unique MAC
address, we have to use hex rather than the usual decimals we're all familiar
with. Using hex to express an address allows us to have many more possible
M
1 Plain text (.txt). In this case, the individual characters in the document
(letters, punctuation, newlines etc.) are each encoded into bytes using
the ASCII encoding, and stored in a simple sequence. This format only
stores the text itself, with no information about formatting, fonts, page
size, or anything like that. It is portable across all Computer systems
and can be read and modified by a huge range of software applications.
The details of the format are freely available and standardized. If the
storage media are damaged, any undamaged sections can be recovered
without problems.
2 Word document (.doc). In this case the text plus formatting, page size
and so on is stored in a complex encoding.
3 PDF (Portable Document Format, .pdf). In this case, the text plus
in
formatting, page size and similar information are stored in a moderately
complex encoding. While the details of this encoding are freely available,
sa
the format is owned by Adobe and can be changed by them at any time,
us
for any reason. The document can be viewed and printed on all major
platforms, using free software provided by Adobe (or others). PDF
H
documents cannot be readily edited.
4 HTML (Hypertext Markup Language, .html). The text, plus simple
q
5 An image format such as JPEG (.jpg) or TIFF. While the image can be
viewed on any modern platform using a wide range of software, editing
the content of the document (the sequence of characters, words etc.)
M
in
the file size. Examples of encoded bitmaps in clued JPG, PNG and GIF file
types.
sa
Binary Representation of Sound
us
In order to digital record sound, a microphone is used, a device that
H
converts the analogue sound into a digital form by altering the output signal
from the device. In order to store this digitally, the voltage is sampled at
q
frequent intervals (typically 48 000 times per second or 48kHz) and stored
a
This equates to slightly over 1.5 million bits per second, or 88 MB per
minute. An 80 minute album stored in such a manner would require 6.9 GB
of storage. There are three ways of altering this:
Sample Rate: By reducing the sample rate (e.g. to 22 kHz), you reduce the
amount of data you need to store. This has quite serious effects on the
quality of the audio.
Compression: Ideally you would sample at the highest practical rate you can
and these use an encoding algorithm to reduce the output file size (this is
why Audacity projects are much bigger in size than the files output). This
can be Lossless compression (e.g. FLAC [and potentially MP3/AAC/Ogg
Vorbis files]) or Lossy compression (e.g. most MP3, AAC and Ogg Vorbis
files). WAV and AIFF files are used for storing uncompressed audio.
in
sa
us
H
a q
ht
us
-M
M