0% found this document useful (0 votes)
6 views5 pages

Overview of Machine, Assembly, and High-Level Languages

Uploaded by

swaruphalder08
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views5 pages

Overview of Machine, Assembly, and High-Level Languages

Uploaded by

swaruphalder08
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Module – 4.

Machine/Assembly / High Level Language – A brief recapitulation.

Programming means developing a sequence of commands or instruction that can be used by a computer system to
perform a predefined task. A programme is a collection of instructions or commands, which are arranged logically to
perform an predefined task. There are three types of languages by which a programme can be written. They are machine
languages, assembly language and high level language.

Machine language: The microcontroller/ microprocessor is a digital device which understand and operates on binary digits
0 (or zero volt) and 1 ((or five volt) stored at voltage levels in the circuits. The microcontroller needs commands in form of
bit patterns (of 0 and1) to perform any operation. The binary bit patterns are called instructions or machine codes which
are recognised and process by a microcontroller to accomplish a task. Every instruction is represented by the unique
pattern to distinguish it from another instruction. Since the microcontroller understands only bit patterns, so every
operation has to be specified only in machine language (i.e. patterns of 0 and 1s). Sometimes, this 0s and 1s can be
represented by HEX code.

Assembly Language: It is very difficult to write an understand instruction using patterns of )s and 1s. Therefore,
manufacturer of microcontroller / microprocessor assigns unique English like word code to all binary instructions which
are referred as mnemonics (e.g. MOV, ADD, SJMP etc). The mnemonic for an Instruction is a word ( usually 3 or 4 letters)
that indicates operation to be performed by that instructions. The entire group of instruction when represented as
mnemonics is called assembly language of the microcontroller. Assembly language is also called low-level language
because it directly deals with internal hardware of the microcontroller. A computer programme known as assembler is
used to convert assembly language programs into machine language.

High Level Language: High Level Languages are English like language. It is so named because programmer need not to
know and worry about the internal details and architecture of the microcontroller to develop the programs.

Features of assembly language or Why high level language?

The assembly-language programs provide direct and precise control of the hardware present in a system. They are

more efficient in terms of memory requirements and execution speed.

Each instruction has two parts, one is operation to be performed called as operation code (op-code) and the second part is
data on which operation is to be performed called as operands.

What is an assembler directive? Name some assemble directives. Discuss about them. With example

The assembler directives are the statements that directs the assembler what to do during assembling. However,
assembler do not create any without creating machine code against the directives. Example: ORG, DB, EQU, END etc.

ORG (origin):-

The origin (ORG) directive is used to indicate the beginning of the addresses. The number that comes after ORG can be
either in hex or in decimal. If the number is not followed by H it is decimal and the assembler will convert it to hex .

Ex:- ORG 0000H

EQU (equate):-

This is used to define a constant without occupying a memory location. The EQU directive does not set aside storage for a
data item but associates a constant value with a data label, so that when the label appears in the program it constant
value will be substituted for the label. In the following example, EQU used for the counter constant and then the constant
is used to load the R3 register.
Ex:-

COUNT EQU 25

MOV R3, # COUNT

END:-

Important pseudo code is the END directive. This indicates to the assembler the end of the source (asm) file. Tthe END
directive is the last line of an 8051 program meaning that in the source code anything after the END directive is ignored by
the assembler.

DB (Define byte):-

The DB directive is the most widely used data directive in the assembler. It is used to define the 8-bit data. When DB is
used to define data, the numbers can be in decimal binary, hex or ASCII format. For decimal “D” after the decimal number,
for binary ‘B’ and hexadecimal ‘H’ required. DB directive is the only directive that can be used to define ASCII strings larger
than the character therefore it should be used for all ASCII data definitions.

Ex: -
ORG 5000 H
DATA 1: DB 28 (Decimal)
DATA 2: DB 39H (HEX)
DATA 3: 0101001 B (Binary)

Objective Questions

1. An assembler directive is,

(a) same as an instruction (b) used to define variables (c) used to start a program (d) used to give commands to an
assembler.

2. The common extensions of an assembly language program are,

(a) .lst (b) .asm (c) .obj (d) .hex

3. The key features of assembly language programmes are,

(a) high code density (b) faster execution (c) portability (d) ease of development.

4. The key features of high level language are,

(a) high code density (b) faster execution (c) portability (d) ease of development.

5. IDE typically include,

(a) assembler (b) compiler (c) simulator (d) all of the above.

6. An assembler converts,

(a) mnemonics into machine language (b) translates high level language into machine language

(c) assembly language into machine language (d) none of these

7. In machine language _____________

(a) programs are written using mnemonics (b) programs are written using hex/binary

(c) programs are written using ASCII code (d) none of these

8. Programs can be loaded in a microcontroller by,

(a) parallel programmers (b) ISP using UART (c) ISP using SPI (d) All of the above
9. Assembler produces (a) .asm (d) .hex

Short questions.

1. What is an assembler?

Ans. Assembler is a computer program used to converts assembly language programme into machine language.

2. Which language requires minimum memory for a programme?

Ans. Machine language.

3. Which files are produced by an assembler?

Ans. Object file (.obj) and list file

4. What is an assembler directive?

Ans. The assembler directives are the statements that directs the assembler what to do during assembling. However,
assembler do not create any without creating machine code against the directives. Example: ORG, DB, EQU, END etc.

5. Define the term "source code"

Ans. The original program developed by a programmer is called source code. Usually the assembly language source code
has “ .asm” or ".src “ extension.

6. Which language is more user-oriented or easy to develop programme. Name one such language.

Ans. High level language. C / Python etc.

7. What is IDE? Name two such IDE.

Ans: An IDE is development software which integrates all tools necessary to develop, test and debug the programs for an
application into single module. It includes editor, assembler, compiler, linker, simulator, tracer, emulator and logic
analyzer. It simulates the hardware components like peripherals, I/O devices and emulators. It also supports code burning
process.

KEIL, RIDE.

8. What is burning a programme?

Ans: The process of loading a program into a microcontroller is more commonly known as downloading a program or
burning a program into a chip. Actually by burning we usually load executable files into microcontroller program memory.

9. List three levels of programming languages.

Ans. Machine language, assembly language and high-level language.

10. What are the most common operations performed by a microcontroller/processor?

Ans. The most common operations are storing and retrieving binary data, arithmetic and logical operations.

11. Define term "word length". What is word length of the 8051?

Ans. The number of bits in binary pattern that microcontroller recognizes and processes at a time is called word length.
Word length of the 8051 is 8 bits.

12. What is an assembler?

Ans. Assembler is a computer program used to convert assembly-language program into machine language.

13. Which language requires minimum memory for a program?

Ans Machine language.


14. Which language is more user-oriented?

Ans. High level language.

15. What is the size of the 8051 instructions?

Ans. Depending upon the instruction it will be one, two or three bytes.

16. List the key characteristics of the high-level language.

Ans. Ease of programming, flexibility and portability.

17. What is editor?

Ans. Editor helps to create source file. It is simply a undocumented text editor. Example: Notepad.

18. Differentiate syntax Logical Errors.

Ans. The assembler is capable of only finding Syntax errors. To check if our program is working correct, we have to run
(execute) and test the program, i.e. assemblers cannot find logical errors (commonly referred as bugs). The errors (syntax
errors) indicated by the assembler should be corrected using the editor.

19. Define Cross Assembler.

An assembler that runs on a computer system, which has different microcontroller/processor than the
microcontroller/processor, for which it assembles the source code. For example, an assembler that runs on an Intel x86
machine and assembles source code of the 8051. Usually, most assemblers are Cross Assemblers.

20. What is Compiler?

[Link] is a program which converts high-level language programs to machine language. It also indicates the syntax errors in
the program, if any. It generates object file corresponding to the target microcontroller.

21. What is Linker?

The linker links more than one object files like object files of the source code files and library object files, if any.

22. What is Simulator?

Ans. Simulator is software that functions (pretends) like hardware without having actual hardware. The 8051
microcontroller simulator gives the user an 8051 environment on the host system (PC). It shows all internal registers,
entire memory and peripherals on the monitor. It supports breakpoint and single stepping facilities that help the user to
debug their program. Since the operation of the microcontroller is simulated, all of the information about the
microcontroller operations is directly available to the programmer and hence allows finding the logical errors.

23. What are the advantages of using Simulator during Application Development?

Ans. Allows simulation of peripherals and I/O devices

Saves the development time

Allows checking of software before the hardware is available to the user.

24. What are the limitation of Simulator?

25. What is In Circuit Debugger (ICD)?

Ans. Debuggers are similar to simulators except that they execute programs in the real microcontroller/processors. This is
done (COM or USB) port. Debugger allows the user to load program into the system memory, execute the program by
single by using a ROM based monitor program in the target board, communicating with a program in the PC through a
serial stepping and detect the logical errors in the program. It allows the modify register contents, memory locations and
rerun the program for different set of data. It also allows using breakpoints. It has all facilities of simulator. The key
feature is that debuggers allow finding logical errors while the program is running on actual hardware. Therefore,it is not a
completely software based tool.

26. What is the key difference between debugger and simulator?

The debugger performs all operations in a real microcontroller while the simulator pretends as if it is a microcontroller
and hence performs all operations only in software.

27. What are the steps to develop an executable (ready to run on microcontroller) program file from a problem
statement?

Ans. After analysing the problem following steps can be taken to develop the executable file.

i) Creating a source code. If the problem is complex one, then it can be break into multiple simple problem.
ii) Assembling all the source files. Of the assembler indicates errors, then we have to correct that syntax errors and
again have to assemble the source file. We have to repeat the process until removal of all errors.
The successful completion of the steps will generate .obj and .lst files.
iii) If the number files is one, then we can directly build the executable file (i.e Hex file). However, if the program
consists of several modules, then we have to use the linker to join them into large object module (called linking
process). (In KEIL IDE, assembling and linking is being done in single step called translating)
iv) After that the executable file may be run through simulator to check the correctness or may be directly burned
into ROM of the microcontroller and can be tested with the help of In-circuit-emulator (ICE).

The complete programme-development cycle is illustrated below.

You might also like