Akın B. Özsaygın

Telechargé par Akın Başar özsaygın
Department of Electrical Electronics | Computer Engineering
Intro to Microprocessors | Embedded Systems Development
EEE 347 | CNG 336
Mod# or Lab #: Name of the lab or module
Name Akın Başar Özsaygın
Department & Roll No # CNG 2591394
Date 6.03.2024
Marks Obtained
Instructor Signature
Don’t write below, for the instructor use only:
Document Version 1.0
Temp designed by: Muhammad Hamza Ishaq (Grad R&T Asst.) EEE, ODTÜ/METU
TASK 1
;
; AssemblerApplication1.asm
;
; Created: 6.03.2024 19:34:00
; Author : Akın Başar Özsaygın
;
; Replace with your application code
.include "m128def.inc"
.equ memaddr=0x100
.equ zeros=0x00
.equ ones=0xFF
.cseg
.org 0x0000
ldi r16, zeros
out ddra, r16
ldi r16, ones
out ddrb, r17
loop: in r18, pina
sts memaddr, r18
out portb, r18
jmp loop
//first I delete the loop part because it infinitely go to loop and it increment r16 and does
not go out from that loop and it gives error
//for the purpose ldi load immediate register and it loads first zeros to r16 which is
00000000 and what out functions do in the what data in r16 which is goes into ddra which is
directly connected with the port a and than it loads ones for the r17 and connect with the
ddrb port for the loop in this case loop goes to to infinitely.and if I change the pina it
changes the output of the r18 register as shown in the below picture.
Here also because of the out portb,r18 line it changes the value in portb and pinb also.
In the upper one also it shows that ddrb is all ones because we load the r17 to ddrb.
TASK 2
;
; AssemblerApplication1.asm
;
; Created: 6.03.2024 19:34:00
; Author : Akın Başar Özsaygın
;
; Replace with your application code
.include "m128def.inc"
ldi r16, 0x99 ;ldi is load immediate so it will load 0x99 hexadecimal to r16 which is 1001
1001 in binary.(R16=0x99)
sts 0x212, r16 ;sts is store direct to data space 0X212 is part of the ram in its specific
name so (0x212=R16)
ldi r16, 0x85 ;R16=0x85 it does the same thing over and over again so ı just write what
content goes where to where
sts 0x213, r16 ;0x213=R16
ldi r16, 0x3f ;R16=0x3f
sts 0x214, r16 ;0x214=R16
ldi r16, 0x63 ;R16=0x63
sts 0x215, r16 ;0x215=R16
ldi r16, 0x12 ;R16=0x12
sts 0x216, r16 ;0x216=R16
This is the code with the explanations
İn the upper image I provided the ram locations from 212$ to 216$ and it shows that
So $212=99,$213=85,$214=3f,$215=63,$216=12
TASK 3
;
; AssemblerApplication1.asm
;
; Created: 6.03.2024 19:34:00
; Author : Akın Başar Özsaygın
;
; Replace with your application code
.include "m128def.inc"
ldi r20, 5 ;so the number 5 is stored to R20 (R20=5).
ldi r21, 2 ;so the number 2 is stored to R21 (R21=2).
add r20, r21 ;so the content of the r21 plus r20 will store in r20 (R20=R20+R21). R20=5+2
R20=7
add r20, r21 ;so the content of the r21 plus r20 will store in r20(R20=R20+R21).R20=7+2
R20=9
sts 0x120, r20;the value in r20 is store 0x120(which is a specific ram adress) (0x120=R20)
So in the upper image it shows that the $ram 120 it shows 9 as a output.
TASK 4
Part 1
;
; AssemblerApplication1.asm
;
; Created: 6.03.2024 19:34:00
; Author : Akın Başar Özsaygın
;
; Replace with your application code
.include "m128def.inc"
ldi r20, 0x30
ldi r21, 0x97
sts 0x105, r20
1 / 12 100%
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !