Making A Lab Report
Making A Lab Report
Making A Lab Report
Hardware Resources
• ATmega16A microcontroller unit
• Universal Programmer
• Resistance 47Ω
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
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.