0% found this document useful (0 votes)
33 views8 pages

Report 5

The document discusses learning assembly language programming on an Arduino board. It describes using an assembler to write programs that perform arithmetic operations and toggle an output pin. While the author was unable to run the toggle code on the Arduino due to tool issues, they were able to simulate it successfully.

Uploaded by

moenali338
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)
33 views8 pages

Report 5

The document discusses learning assembly language programming on an Arduino board. It describes using an assembler to write programs that perform arithmetic operations and toggle an output pin. While the author was unable to run the toggle code on the Arduino due to tool issues, they were able to simulate it successfully.

Uploaded by

moenali338
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
You are on page 1/ 8

Experiment 5

“Familiarization of assembly language program in a


microcontroller”
Abstract: Assembly language is a low-level programming language for a computer or other
programmable device that is closest to the machine language. In the experiment, we have
learned about AVR assembly programming. Later we have implemented the language on
Arduino.

I. INTRODUCTION:
Assembly language is a low-level programming language for a computer or other
programmable device specific to a particular computer architecture in contrast to most high-
level programming languages, which are generally portable across multiple systems. Assembly
language is converted into executable machine code by a utility program referred to as an
assembler like NASM, MASM, etc.
The main objective of the experiment is-
1. To get familiarize with assembly language.
2. To implement a blink using assembly language programs.

II. THEORY & METHODOLOGY


The closest programming language to machine language for a computer or other programmable
device is assembly language. It is often specific to a particular computer architecture so there
are multiple types of assembly languages. ARM is an increasingly popular assembly language.

Fig 01: Hierarchy of Programming Languages


Data Memory Space
Data memory space in AVR is divided into 3 parts. General Purpose Registers (GPRs),
Input/Output Registers, Internal SRAM.
Registers: CPU uses registers to store data temporarily. Most AVRs have 8-bit registers. Two
kinds of registers. The General Purpose Registers (GPRs) & I/O registers.

1|Page
Experiment 5

GPRs: ARVs have 32 general purpose registers. They are R0 to R31. And located in the
lower’s location of memory address ($0000 to $001F). They can be used by all arithmetic and
logical instructions.
I/O Registers: I/O registers are dedicated to special functions such as status register, timers,
serial communications, I/O port, ADC etc. For this reason, they are called special functions
registers (SFRs). The function of each I/O register is fixed by the CPU designer as they are
used to control the microcontroller or peripheral functions supported by the microcontroller.
Internal SRAM: Internal SRAM is used for storing data. Each location of the SRAM can be
accessed directly by its address. Each location is 8 bits wide.
Assembly language equivalents for typical traditional microprocessor instructions, along with
a detailed description of the operation called for by the instruction. When writing a
microcomputer program, it is easier and faster to use the abbreviated name rather than the
complete function name.

Fig 02: Instruction set

III. EXPERIMENTAL PROCEDURE


Equipment:
1. Microchip studio [ver.7]
2. PC having Intel Microprocessor
3. Arduino Uno

2|Page
Experiment 5

In order to learn the assembler programming language Microchip Studio AVR was using in
this experiment.

Fig 03: Start page

Fig 04: Selecting new project

3|Page
Experiment 5

Fig 05: Device selection

Fig 06: Programming Interface

On this platform we can give different type of instruction to program.

4|Page
Experiment 5

Fig 07: A basic code written

Fig 08: Code for arithmetic operation

5|Page
Experiment 5

Code for Toggle all 8 bits of Port B forever with some delay between on & off state:

Fig 09: Code for Toggle with Build Solution


Debug:

Fig 10: External tool

6|Page
Experiment 5

After specified the tools to upload the code, we have started the debugging process. For the
unavoidable reasons we were unable to implement the code on Arduino. But we have used the
simulator tools o simulate it and it was running successfully.

IV. RESULTS
Practical Results:

Fig 11: Avrdude was not working


We were unable to implement the toggle code on the Arduino Uno due to the external tools'
malfunction. Other programs were correctly operating
.
V. Discussion
This experiment introduces assembly language programming. Assembler was created using
Microchip Studio. We have created several programs, such as arithmetic/logical operations,
using some fundamental instructions. Then, using assembly language, a toggle action was
created. Our AVR microcontroller for this operation was the Atmega328P. Therefore, we ran
the application on an Arduino Uno.
Assembly language helps programmers to write human-readable code that is almost similar to
machine language. Machine language is difficult to understand and read as it is just a series of
numbers. Assembly language helps in providing full control of what tasks a computer is
performing.

7|Page
Experiment 5

VI. Conclusion
The learning of assembly language is still important for programmers. It helps in taking
complete control over the system and its resources. By learning assembly language, the
programmer can write the code to access registers and retrieve the memory address of pointers
and values. It mainly helps in speed optimization that increases efficiency and performance.
Assembly language learning helps in understanding the processor and memory functions. If
the programmer is writing any program that needs to be a compiler, that means the programmer
should have a complete understanding of the processor. Assembly language helps in
understanding the work of processors and memory. It is cryptic and symbolic language. The
goals of the experiment were achieved. The knowledge from the experiment will be very useful
resource for further study.

VII. References
[1] cheatsheets/AVR_assembly_programming.md at master · aagontuk/cheatsheets. (n.d.).
GitHub. Retrieved October 27, 2022, from
https://github.com/aagontuk/cheatsheets/blob/master/AVR_assembly_programming.
md
[2] Upload AVR program to Arduino with MicroChip Studio. (n.d.). Arduino Project Hub.
Retrieved October 27, 2022, from https://create.arduino.cc/projecthub/patrick-
fitzgerald2/upload-avr-program-to-arduino-with-microchip-studio-fc1a6e
[3] American International University-Bangladesh. (Fall 22-23.). Familiarization of assembly
language program in a microcontroller: MES Student lab manual 05.

8|Page

You might also like