Sei sulla pagina 1di 5

Experiment No.

1
Objective:
Introduction to differentiate between binary, decimal and hexadecimal number system and
also convert number in one number system to another number system. A brief understanding of
assembly language and understands the difference between low-level and high-level languages.

Theory:
Most people today use decimal representation to count. In the decimal system there are 10
digits: 0, 1, 3, 4, 5, 6, 7, 8, and 9. These digits can represent any value, for example, 754. The value
is formed by the sum of each digit, multiplied by the base (in this it is 10 because there are 10
digits in decimal system) in power of digit position (counting from zero):

2
7 * 10  5*101  4*10 0  700  50  4  754

Base Digit _ Position

Position of each digit is very important! For example if you place “7” at the end value it
will become another value.

2
5* 10  4*101  7 *10 0  500  40  7  547

Base Digit _ Position

Important note: any number power of zero is 1; even zero in power of zero is 1.

100  00  x 0  1

Computers are not as smart as humans are (or not yet), it’s easy to make an electronic
machine with two states on and off, or 1 and 0. Computers use binary system, binary system uses
2 digits: 1, 1. and thus the base are 2. Each digit in a binary number is called a BIT, 4 bits form a
NIBBLE, 8 bits form a BYTE, two bytes form a WORD, and two words form a DOUBLE WORD
(rarely used).

High _ Bit nibble byte Low _ Bit

00010111 00010111 00010111 00010111

double _ word word

There is a convention to add “b” in the end of a binary number, this way we can determine
that 101b is a binary number with decimal value of 5. This binary number 10100101b equals to
decimal value of 165:

10100101b
5
 1* 27  0* 26  1* 2  0* 2 4  0* 23  1* 2 2  0* 21  1* 2 0
 128  0  32  0  0  4  0  1
 165(decimal _ value)

Hexadecimal system uses 16 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, and 9, A, B, C, D, E, and F.


and thus the base are 16. Hexadecimal numbers are compact and easy to read.

Decimal Binary Hexadecimal

(base 10) (base 2) (base 16)

0 0000 0

1 0001 1
2 0010 2

3 0011 3

4 0100 4

5 0101 5

6 0110 6

7 0111 7

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

Hexadecimal Value

1234

0001 0010 0011 0100

(binary numbers)

There is a convention to add “h” in the end of a hexadecimal number, this way we can determine
that 5Fh is a hexadecimal number with value of 95. We also add “0” (zero) in the beginning of
hexadecimal numbers that begin with a letter (A…F), for example 0E120h.

The hexadecimal number 1234h is equal to decimal value 4660:


1234h
3
 1* 16  2*16 2  3*161  4*160  4660
Base Digit _ Position Decimal _ Value

Assembly languages are a type of low-level languages for programming computers,


microprocessors, microcontrollers, and other (usually) integrated circuits. They implement a
symbolic representation of the numeric machine codes and other constants needed to program a
particular CPU architecture.

This representation is usually defined by the hardware manufacturer, and is based on


abbreviations (called mnemonics) that help the programmer remember individual instructions,
registers, etc. An assembly language family is thus specific to certain physical (or virtual)
computer architecture. This is in contrast to most high-level languages, which are (ideally)
portable.

A utility program called assembler is used to translate assembly language statements into the
target computer’s machine code. The assembler performs a more or less isomorphic translation (a
one-to-one mapping) from mnemonic statements into machine instructions and data. This is in
contrast with high-level languages, in which a single statement generally results in many machine
instructions.

Assembly language is a low level programming language. You need to get some knowledge
about computer structure in order to understand anything.

The simple computer model is given below:

Random Access Memory

(RAM)

Central Processing Unit

(CPU)
Devices:

Display, Keyboard etc


The System Bus connects the various components of a computer. The CPU is the heart of
the computer, most of computations occurs inside the CPU. RAM is a place to where the programs
are loaded in order to be executed.

Conclusion:

Potrebbero piacerti anche