[go: up one dir, main page]

0% found this document useful (0 votes)
12 views9 pages

Making A Lab Report

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 9

Department of Electrical Engineering

Faculty Member: Shaiza Malik Dated: 10-03-2024

Course/Section: Microprocessor Systems Semester: _4th

Lab 5: Functions & Delays

EE-222 Microprocessors Systems

PLO4 -CLO3 PLO5- PLO8-CLO5 PLO9-


CLO4 CLO6
Name Reg. No Viva / Analysis Modern Ethics and Individual
Quiz / of data Tool Safety and Team
Lab in Lab Usage Work
Perform Report
ance
5 Marks 5 Marks 5 Marks 5 Marks 5 Marks
Muhammad Ashar 404818
Javid

Muhammad Ishaq 412908

Ali Ahsan 412637


Objective
By the end of this lab you will be able to

1. Control GPIOs of ATmega16A

2. Implement branches in assembly language

3. Implement calculated delays

4. Break the code down to modular functions

Hardware Resources
• ATmega16A microcontroller unit

• Universal Programmer

• Seven Segment Display

• Resistance 47Ω

• LEDs (may use from trainer kit)

• Switch or Button (may use from trainer kit)

Task1:
CODE:
.ORG 0x00
ldi R16,0x00
out DDRA,R16
ldi R16,0xFF
out DDRB, R16
l1:
IN R16,PINA
OUT PORTB,R16
rjmp l1

SCREENSHOT:
Hardware implementation:
TASK2:
.ORG 0x00
LDI R16, HIGH(RAMEND)
OUT SPH, R16
LDI R16, LOW(RAMEND)
OUT SPL, R16
l1:
ldi R17,0xFF
out DDRB,R17
out portb,R17
call delay
ldi R17,0x00
out portb,R17
jmp l1

delay:
ldi r18, 0xc8
outer_loop: ldi r19, 0xd0
inner_loop: ldi r20,0x03
inner_loop_1:subi r20,1
brne inner_loop_1
subi r19,1
brne inner_loop
subi r18,1
brne outer_loop
nop
ret
Hardware implementation:
Task 3

Code:
. ORG 0x00
LDI R16, HIGH(RAMEND)
OUT SPH, R16
LDI R16, LOW(RAMEND)
OUT SPL, R16

LDI R17, 'R'


STS 0x200 , R16
LDI R18, 'A'

STS 0x201 , R16


LDI R19, 'C'

STS 0x202 , R16


LDI R20, 'E'

STS 0x203 , R16


LDI R21, 'C'

STS 0x204 , R16


LDI R22, 'A'
STS 0x205 , R16
LDI R23, 'R'

STS 0x206 , R16

CALL CHECKPALINDROME
CHECKPALINDROME:
PUSH R17
PUSH R18
PUSH R19
PUSH R20
PUSH R21
PUSH R22
PUSH R23

POP R24
POP R25
POP R26
POP R27
POP R28
POP R29
POP R30
CP R30, R24
bRne L1
CP R29, R25
bRne L1
CP R28, R26
BRne L1
ldi R16,1
ret
L1:
ldi R16,0
ret
Conclusion:
In this lab, we learned how to code for microprocessors using Atmel Studio, how to handle input and
output values, and how to check for palindrome words using machine language. Additionally, we
acquired knowledge about the delay function, which serves as a basic time delay mechanism. We
successfully programmed a toggle system to control the LED light, switching it on and off with specific
time delays. Overall, the lab provided valuable insight into assembly language programming. The lab
staff and environment were conducive to learning, fostering a collaborative and friendly atmosphere.

You might also like