You are on page 1of 24

bits and bytes

bits
A bit (a contraction of binary digit) is the basic capacity of information in computing and telecommunications; a bit represents either 1 or 0 (one or zero) only. The representation may be implemented, in a variety of systems, by means of a two state device.

bytes
A group of nine related bits is called byte, which represents a storage location internally in memory and on external devices. Each byte consists of eight bits for data and one bit for parity.

bytes
1 bit bit bit bit bit bit bit bit bit 0 1 0 0 0 0 1 0
data bits parity

parity bit
A parity bit is a bit that is added to ensure that the number of bits with the value one in a set of bits is even or odd. Parity bits are used as the simplest form of error detecting code.

rule of parity
the number of bits that are ON (1) in each byte must always be ODD.

example:

byte
0 1

1 2

1 3

even odd

byte
0 0 1 0 1 0 1 0

odd

example:

error checking

odd OK

error checking

even
transmission error

related byte
A program can treat a group of one or more related bytes as a unit of data., such as time or distance. A group of bytes that defines a particular value is a commonly known as a DATA ITEM or FIELD. The processor also supports certain data sizes that are natural to it.

word
a 2- byte (16-bit) data item

doubleword
a 4- byte (32-bit) data item

quadword
a 8- byte (64-bit) data item

paragraph
a 16- byte (128-bit) area

kilobyte (KB)
the number 210 equals 1,024 640 Kilobytes X 1,024 = 655,360 Bytes

10
10 9 8
256

7
128

6
64

5
32

4
16

3 2
8 4

1
2

1024 512

megabyte (MB)
the number 220 equals 1,024

1 Megabyte

= 1,024 Kilobytes

= 1,048,576 Bytes

conversion table

binary number system


bit value
1 0
0 0

0
4 2

1 2 1

0 1 0

position value 128

64 32 16 8 6 5 4 3

bit number

binary arithmetic
0 0 0 0 1 1 1 1 10 1 1 1 11

binary arithmetic binary


00111100 00110101 01110001

decimal
60 53 113

negative binary numbers


apply the twos compliment rule number + 65: reverse the bits: add 1:

number -65

0100000 1011111 1 0 1 10111111

1 0 1 1 1 1 1 1 64 32 16 8 4 2 1 128
- 128

32 16 8

-128
-65

63

0100000 1 +10111111 (1)0000000 0

+65 -65 00

01000001 00010011 01000111 +00101101 +00111111 +00110101 01101110 01010010 01111100

01000001 65 +(-42) +11010110 2 (1)00010111 3 01000001 65 +(-13) 11110011 5 (1)00110100 2

You might also like