HoDucDongPhuong EEEEIU21047 Lab1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 45

VIETNAM NATIONAL UNIVERSITY – HOCHIMINH CITY

INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

EE084IU
Micro-processing Systems Lab

LAB 1

AVRStudio, Assembly and Digital


Input-Output
Student name: Hồ Đức Đông Phương

Student ID: EEEEIU21047

Class: Tuesday Morning

Date: 02/04/2024

GRADING GUIDELINE FOR LAB REPORT


Number Content Score Comment

1 Format (max 9%)

- Font type Yes No

- Font size Yes No

- Lab title Yes No

- Page number Yes No

- Table of contents Yes No

- Header/Footer Yes No

- List of figures (if exists) Yes No

- List of tables (if exists) Yes No

- Lab report structure Yes No

2 English Grammar and Spelling (max 6%)

- Grammar Yes No

- Spelling Yes No

3 Data and Result Analysis (max 85%)


Total Score

Signature:

Date:
International University School of Electrical Engineering

Table of Contents

List of Figures........................................................................................................................................................ ii

List of Tables......................................................................................................................................................... iii

1 Theoretical Background................................................................................................................................1

2 Experimental Procedure............................................................................................................................... 2
2.1 Experiment 1............................................................................................................................................ 2
2.2 Experiment 2............................................................................................................................................ 2
2.3 Experiment 3............................................................................................................................................ 2

3 Experimental Results..................................................................................................................................... 3
3.1 Experiment 1............................................................................................................................................ 3
3.2 Experiment 2............................................................................................................................................ 3
3.3 Experiment 3............................................................................................................................................ 3

4 Discussion of Results...................................................................................................................................... 4

[Course’s name] i [Course number]


International University School of Electrical Engineering

List of Figures
Figure 1: Circuit diagram 1........................................................................................................................... 2
Figure 2: Circuit diagram 2........................................................................................................................... 2
Figure 3: Simulation for experiment 1......................................................................................................3

[Course’s name] ii [Course number]


International University School of Electrical Engineering

List of Tables
Table 1: Comparison of circuit parameters............................................................................................1
Table 2: Data of experiment 1...................................................................................................................... 3

[Course’s name] iii [Course number]


International School of Electrical
University Engineering
1 Theoretical Background

2 Experimental Procedure

Problem 1: Follow step by step the AVRStudio tutorial to create a new project and carry
out the simulation

Check point:

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Problem 2: List contents of the related registers and SREG (Status) register for each line
of the following program.

For home work lab report activity, translate each line of this program into binary
machine code.

[Course’s 1 [Course
name] number]
International School of Electrical
University Engineering
.include "m32def.inc"

ldi r16, low(ramend)

out spl, r16

ldi r16,high(ramend)
out sph, r16
ser r20

dec r20

dec r20 subi

r20, -7 inc

r20

neg r20

com r20

clr r20

ldi r20,0x77

ldi r21,0x33

ldi r22,0xAA

Ldi r23,0xEE

add r20,R22 adc

r22,R23 adc

r21,r20 push

r22

push r21

Pop r22

Pop r21

[Course’s 2 [Course
name] number]
International School of Electrical
University Engineering
Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Problem 3: List contents of the R17 and SREG (Status) registers for each line of the
following program.

For home work lab report activity, translate each line of this program into binary
machine code.

.include "m32def.inc"

ldi r16, low(ramend)


out spl, r16
ldi r16, high(ramend)
out sph, r16
ldi r17, 103

ldi r17, 0b00110101

ldi r17, 0xC6

andi r17, 0x65

ldi r17, 0x7A

cpi r17, 0Xff

subi r17, 0xFF

andi r17,0x55

ori r17,0xAA

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Problem 4 : Give the comment for eachline of the program, Draw the flow chart for
following program, explain the function of this program. Simulate and Run to test this code in

[Course’s 3 [Course
name] number]
International School of Electrical
University Engineering
Proteus. For home work lab report activity, translate each line of this program into binary
machine code.

.ORG 00

LDI

R18,0xFF OUT

DDRC, R18 LDI

R16, 15

LDI R17, 0

L1: ADD R17,R16

DEC R16

CPI

R15,0x05 BRNE

L1

STS

0x600,R17 OUT

PORTC,R17:

L2: RJMP L2

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Problem 5 : Give the comment for eachline of the program, Draw the flow chart for
following program, explain the function of this program. Simulate and run to test this code in
[Course’s 4 [Course
name] number]
International School of Electrical
University Engineering
Proteus.

.include "m328pdef.inc"

.equ numB = 20

.def tmp = r16

.def findnum = r19

[Course’s 5 [Course
name] number]
International School of Electrical
University Engineering
.def loopCt= r17

.dseg

.org SRAM_START

sArr: .BYTEnumB

.cseg

.org 0x00

ldi

XL,LOW(sArr)

ldi XH,HIGH(sArr)

ldi

ZL,LOW(pArr<<1)

ldi ZH,HIGH(pArr<<1)

ldi loopCt,numB

arrLp:

lpm tmp,Z+

st X+,tmp

dec

loopCt

brne arrLp

[Course’s 6 [Course
name] number]
International School of Electrical
University Engineering
ldi

XL,LOW(sArr)

ldi XH,HIGH(sArr)

ldi loopCt,numB

ldi findnum,0x00

F_Lp:

LD R16,X+

CP findnum,R16

BRCC CHECK_counter

[Course’s 7 [Course
name] number]
International School of Electrical
University Engineering
MOV findnum,R16

CHECK_counter:

DEC loopCt

BRNE F_Lp ;

HERE: JMP HERE

pArr: .db

0,1,2,3,4,5,6,7,8,9,\

10,11,12,13,14,15,16,\

17,18,19

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Problem 6: Analyze the following code. How would the Port I/O pins behave if this code was
downloaded to and running on the microcontroller. Calculate the time delay for the delay
subroutine if the system has an AVR with a frequency of 1MHz. Run the code in AVR Proteus,
using virtual oscilloscope monitor Port C, compare the calculated time delay and the testing
delay time. Using Burn-E software and Programming Circuit to download and run on the
microcontroller Kit.
.include "m32def.inc"

LDI R16,
low(RAMEND) OUT SPL,
R16

[Course’s 8 [Course
name] number]
International School of Electrical
University Engineering
LDI R16, high(RAMEND)
OUT SPH, R16

LDI R16, 0xFF

OUT DDRB, R16

mloop: LDI R16, 0x00

OUT PORTB, R16

call delay

LDI R16, 0xFF

[Course’s 9 [Course
name] number]
International School of Electrical
University Engineering
OUT PORTB, R16

call delay

RJMP mloop

d
elay: LDI R20, 200

LDI R18, 200

back: LDI R25, 100


NOP

NO
P DEC
R18 NOP

dloop: NOP DEC


R25

BRNE
dloop NOP

DEC R20

BRNE
back RET

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in AVR Kit

Problem 7: : Give the comment for eachline of the program, what is the function of
following program? Simulate and Run to test this code in proteus.

[Course’s 10 [Course
name] number]
International School of Electrical
University Engineering
.INCLUDE "M32DEF.INC"

.EQU SRAM_Address= 0x0060;

.DEF a = R1

[Course’s 11 [Course
name] number]
International School of Electrical
University Engineering
.DEF b = R2

.DEF c = R3

.DEVICE ATmega32 ;

.DSEG ;

.ORG 0x0060 ;

data: .BYTE 1

.CSEG

.ORG 0x0000

RJMP START

.ORG

0x2A

START:

LDI R20, 0xFF;

OUT DDRB , R20;

LDI R20 ,

0xAA; OUT PORTB

,R20;

STS data ,

R20; LDS R19

,data ;

[Course’s 12 [Course
name] number]
International School of Electrical
University Engineering
LDI XH, HIGH(SRAM_Address);

LDI XL, LOW(SRAM_Address)

LD a, X+ ;

LD b, X+ ;

LD c, X ;

ST X , R20;

MAIN:

RJMP MAIN

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in AVR Kit

[Course’s 13 [Course
name] number]
International School of Electrical
University Engineering

Problem 8: Give the comment for eachline of the program, what is the function of
following program? Simulate and Run to test this code in Proteus.

.INCLUDE "M32DEF.INC"

.DEVICE ATmega32

.ORG 0x0000 RJMP

START

.ORG

0x002A

START:

Ldi r19,0x66

Ldi r20,0x33

cp r19,r20

breq IF

ELSE:

LDI R16 , 0x11;

RJMP ENDIF

IF :

LDI R16 , 0x22;

ENDIF :

MAIN:

[Course’s 14 [Course
name] number]
International School of Electrical
University Engineering
RJMP MAIN

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in Protues

[Course’s 15 [Course
name] number]
International School of Electrical
University Engineering

Problem 9: Write a Assembly program to monitor the PB3 bit. When it is LOW, send $38 to
PORTC. If it is HIGH, send $43 to PORTC.

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in Protues

Problem 10: Write a Assembly program to control 32 LEDs connected to


PORTA,PORTB,PORTC and PORTD with different Scenario, using the Delay following
function to make delay lighting time of each LED .
Delay_1s:
LDI R20,68 ;
DL3: LDI R21,100 ;
DL2: LDI R22,48 ;
DL1: DEC R22 ;
BRNE DL1 ;
DEC R21 ;
BRNE DL2 ;
DEC R20 ;
BRNE DL3 ;
RET ;

3 Experimental Result

3.1 Experiment 1

Problem 1: Follow step by step the AVRStudio tutorial to create a new project and carry out the
simulation

Check point:

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

[Course’s 16 [Course
name] number]
International School of Electrical
University Engineering

3.2 Experiment 2

List contents of the related registers and SREG (Status) register for each line of the following program.

For home work lab report activity, translate each line of this program into binary machine code.

.include "m32def.inc" ;Include the library of atmega32 micro-pro

ldi r16, low(ramend) ;loaded with the low byte of “Ramend”

out spl, r16 Output write the value of r16 to stack pointer low

ldi r16,high(ramend) ;loaded with the hight byte of “Ramend”


out sph, r16 ;Out put write the value of r16 to stack pointer high
ser r20 ;Sets register to all ones ( 0xff)

dec r20 ;Decrements the value of register r20 by 1

dec r20 ;Decrements the value of register r20 by 1 again

subi r20, -7 ;Subtract 7 from the value of r20

inc r20 ;increments the value of register r20 by 1

[Course’s 17 [Course
name] number]
International School of Electrical
University Engineering
neg r20 ;two’s complement negation – negates the value of
register r20

com r20 ;complement- take one complement of r20

clr r20 ;clear register r20 sets it to 0

ldi r20,0x77 ;loads the value 0x77 to register r20

ldi r21,0x33 ;loads the value 0x33 to register r21

ldi r22,0xAA ;loads the value 0xAA to register r22

Ldi r23,0xEE ;loads the value 0xEE to register r23

add r20,R22 ;add the values of register r20 and r22 and store it into r20

adc r22,R23 ;add with carry -add the values of r22 and r23 and carry
flag, storing the result in r22

adc r21,r20 ;add with carry-add the values of r21 and r20 and carry
flad, storing the result in 21

push r22 ;push the value of register r22 onto the stack

push r21 ;push the value of register r21 onto the stack

Pop r22 ;Pop-Pops the top value from mthe stack into register r22

Pop r21 ;Pop-pops the top value from the stack into register r21

Check point:

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

3.3 Experiment 3

List contents of the R17 and SREG (Status) registers for each line of the following program.

For home work lab report activity, translate each line of this program into binary machine code.

[Course’s 18 [Course
name] number]
International School of Electrical
University Engineering
. include "m32def.inc"

ldi r16, low(ramend) ;


out spl, r16 ; 1011 1011 0000 1110
ldi r16, high(ramend) ;
out sph, r16 ; 1011 1001 0000 1000
ldi r17, 103 ; 1110 1010 0001 0011

ldi r17, 0b00110101 ; 1110 0011 0001 0101

ldi r17, 0xC6 ; 1110 1100 0001 0110

[Course’s 19 [Course
name] number]
International School of Electrical
University Engineering
andi r17, 0x65 ; 0111 0110 0001 0101

ldi r17, 0x7A ; 1110 0111 0001 1010

cpi r17, 0Xff ; 0011 1111 0001 1111

subi r17, 0xFF ; 0101 1111 0001 1111

andi r17,0x55 ; 0111 0101 0001 0101

ori r17,0xAA ; 0110 1010 0001 1010

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

3.4 Experiment 4

Give the comment for eachline of the program, Draw the flow chart for following program, explain the
function of this program. Simulate and Run to test this code in Proteus. For home work lab report activity,
translate each line of this program into binary machine code.

.ORG 00

LDI R18,0xFF ;set program counter to address 0, indicating the start of the program

OUT DDRC, R18 ;Loads the immediate value 0xFF into register r18.sets all pins of port
C as output pins

LDI R16, 15 ;Loads the immediate value 15 into register R16.

LDI R17, 0 ;Loads the immediate value 0 into register R17

L1: ADD R17,R16 ;adds the value of R16 to R17.

DEC R16 ;Decrements the value of R16

CPI R15,0x05 ;Compares the value of R15 with the immediate value 0X05

BRNE L1 :Branches back to label L1 if R15 is not equal to 0X05

STS 0x600,R17 ;Stores the value of R17 to memory address 0X600

OUT PORTC,R17: ;Output the value of R17 to port C


[Course’s 20 [Course
name] number]
International School of Electrical
University Engineering
L2: RJMP L2 ; Unconditionall jumps back to label L2, creating infinite loop

 The function of this program:

This software configures port C for output and initializes two registers, R16 and R17. It then enters
a loop in which the value of R16 is continuously added to R17 and decremented until R16 reaches
5. Once R16 equals 5, the value of R17 is saved in memory address 0x600 and sent to port C.
Finally, it goes into an unending cycle.

The simulation:

The flowchart:

[Course’s 21 [Course
name] number]
International School of Electrical
University Engineering

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

3.5 Experiment 5

: Give the comment for eachline of the program, Draw the flow chart for following program, explain
the function of this program. Simulate and run to test this code in Proteus.

.include "m328pdef.inc"

.equ numB = 20 ;Define constant for number of bytes as 20

.def tmp = r16 ; Define temporary register

.def findnum = r19 ; Define register for finding numbers

.def loopCt = r17 ; define loop counter register

.dseg ;start of data segment

[Course’s 22 [Course
name] number]
International School of Electrical
University Engineering
.org SRAM_START ;Start of SRAM

sArr: .BYTE numB ;Define byte array sArr with size numB

.cseg ;Start of code segment

.org 0x00 ;Program start address

ldi XL,LOW(sArr) ; Load low byte of sArr address into XL

ldi XH,HIGH(sArr) ; Load high byte of sArr address into XH

ldi ZL,LOW(pArr<<1) ; Load low byte of pArr address shifter left by 1 into ZL

ldi ZH,HIGH(pArr<<1) ; Load high byte of pArr address shifter left by 1 into ZH

ldi loopCt,numB ;Initialize loop counter with numB

arrLp: ;Start of array copy loop

lpm tmp,Z+ ;load program memory into tmp, increment Z

st X+,tmp ; store tmp into data memory, increment X

dec loopCt ; Decrement loop counter

brne arrLp ; Branch if loop counter not qual to zero

ldi XL,LOW(sArr) ; Load low byte of sArr address into XL

ldi XH,HIGH(sArr) ; Load high byte of sArr address into XH

ldi loopCt,numB ; Reset loop counter to numB

ldi findnum,0x00 ; Initialize findnum to 0

F_Lp: ;Start of finding loop

LD R16,X+ ; Load data from X into R16, increment X

CP findnum,R16 ; Compare findnum with R16

BRCC CHECK_counter ; Branch if carry flag is clear (R16> findnum)

MOV findnum,R16 ;Move R16 to findnum

CHECK_counter: ;Check counter

DEC loopCt ;Decrement loop counter


[Course’s 23 [Course
name] number]
International School of Electrical
University Engineering
BRNE F_Lp ;Branch to F_Lp if loop counter is not zero

HERE: JMP HERE ; Infinite loop

pArr: .db 0,1,2,3,4,5,6,7,8,9,\ :Define byte array pArr

10,11,12,13,14,15,16,\

17,18,19

 The function of this program:

This program first replicates the contents of the byte array'sArr' to program memory 'pArr', after
which it gets the maximum value within the array 'pArr'. It accomplishes this by iterating through
the array, comparing each element to the current maximum value ('findnum'), and updating
'findnum' if a higher value is discovered. Finally, it goes into an unending cycle.

The flowchart:

[Course’s 24 [Course
name] number]
International School of Electrical
University Engineering

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

3.6 Experiment 6

Analyze the following code. How would the Port I/O pins behave if this code was downloaded to and
running on the microcontroller. Calculate the time delay for the delay subroutine if the system has an AVR
with a frequency of 1MHz. Run the code in AVR Proteus, using virtual oscilloscope monitor Port C,
compare the calculated time delay and the testing delay time. Using Burn-E software and Programming
Circuit to download and run on the microcontroller Kit.
.include "m32def.inc" ; directive includes a predefined macro file for
the ATmega32 microcontroller

[Course’s 25 [Course
name] number]
International School of Electrical
University Engineering
LDI R16, low(RAMEND) ; loads the low byte of the RAM end address
into register R16

OUT SPL, R16 ; sets the stack pointer low byte (SPL) to
the value in R16
LDI R16, high(RAMEND)
; set the high byte of the stack pointer.

OUT SPH, R16


LDI R16, 0xFF ; loads R16 with 0xFF, which represents all bits
set (all pins high).
OUT DDRB, R16 ; configures all pins of Port B as output.
mloop: ;Marks the beginning of a loop labeled
as LDI R16, 0x00
; setting R16 to 0x00 (all pins low) and writing it
to PORTB
OUT PORTB, R16

[Course’s 26 [Course
name] number]
International School of Electrical
University Engineering
call delay ; subroutine introduces a delay.
LDI R16, 0xFF
OUT PORTB, R16 ; R16 is set to 0xFF (all pins high) and written to
PORTB.
call delay ; subroutine introduces a delay.
RJMP mloop ; Repeat the loop indefinitely

delay: ; Marks the beginning of a loop labeled as delay


LDI R20, 200
;R20 and R18 are initialized to 200.
LDI R18, 200
back: ; marks the beginning of an outer loop labeled as
back
LDI R25, 100 ; R25 is loaded with the value 100.
NO P ; Two NOP instructions (no-operation)
are included, which effectively introduce a small delay.

NOP

DEC R18 ; R18 is decremented by 1

Dloop : The dloop label marks the beginning of the


inner loop.
NOP : Another NOP instruction is included for a slight
delay.
DEC R25 ; R25 is decremented by 1
BRNE dloop ; instruction checks if R25 is not equal to zero If
R25 is still nonzero, the loop repeats.
NOP ; After the inner loop completes, we have a
final NOP instruction.
DEC R20 ; R20 is decremented by 1
BRNE back ; Instruction checks if R20 is not equal to zero. If
R20 is nonzero, the entire process repeats from the back label.

[Course’s 27 [Course
name] number]
International School of Electrical
University Engineering
RET ; instruction returns from the delay subroutine.

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in AVR Kit

Port I/O pin behavior: • Port B's pins are initially set to low.
• After a wait, all pins on port B will be set to high.

• The pattern repeats infinitely.


Calculate the time delay:
Total delay = (200*(1+1)) = 80,000 CPU cycles.
With a CPU frequency of 1MHz, the delay in seconds is 80,000/1,000,000 = 0.08 seconds.

3.7 Experiment 7

Give the comment for eachline of the program, what is the function of following program? Simulate
and Run to test this code in proteus.

.INCLUDE "M32DEF.INC" ; Including the predefined definitions for


ATmega32

.EQU SRAM_Address= 0x0060; ; Define SRAM_Address as 0x0060

.DEF a = R1 ; Define register a as R1

.DEF b = R2 ; Define register b as R2

.DEF c = R3 ; Define register c as R3

.DEVICE ATmega32 ; ; Define the target microcontroller as ATmega32

.DSEG ; Data Segment

.ORG 0x0060 ; ; Start of data segment at address 0x0060

data: .BYTE 1 ; Define a byte-sized variable 'data'

.CSEG ; Code Segment

.ORG 0x0000 ; Start of code segment at address 0x0000


[Course’s 28 [Course
name] number]
International School of Electrical
University Engineering
RJMP START ; Jump to the START label

.ORG 0x2A ; Code placed at address 0x2A

START:

LDI R20, 0xFF; ; Load immediate value 0xFF into register R20

OUT DDRB , R20; ; Output the value of R20 to the Data Direction Register
B

LDI R20 , 0xAA; ; Load immediate value 0xAA into register R20

OUT PORTB ,R20; ; Output the value of R20 to the PORTB register

STS data , R20; ; Store the value of R20 into the variable 'data'

LDS R19 ,data ; ; Load the value of 'data' into register R19

LDI XH, HIGH(SRAM_Address); ; Load the high byte of SRAM_Address


into register XH

LDI XL, LOW(SRAM_Address) ; Load the low byte of SRAM_Address into


register XL

LD a, X+ ; ; Load the value from the address pointed to by X into


register a, and increment X

LD b, X+ ; ; Load the value from the next address pointed to by X into


register b, and increment X

LD c, X ; ; Load the value from the address pointed to by X into


register c

ST X , R20; ; Store the value of R20 into the address pointed to by X

MAIN:

RJMP MAIN ; Infinite loop, continuously jumping back to MAIN

 The function of this program:

_The program initializes some registers and performs basic input/output operations, memory
operations, and looping.

[Course’s 29 [Course
name] number]
International School of Electrical
University Engineering
Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in AVR Kit

 The Simulation of this program:

3.8 Experiment 8

Give the comment for eachline of the program, what is the function of following program? Simulate
and Run to test this code in Proteus.

.INCLUDE "M32DEF.INC" ; Included definitions specific to


the ATmega32 microcontroller.

.DEVICE ATmega32 ; Specifies that you’re targeting


the ATmega32.ORG 0x0000 microcontroller.

RJMP START ; This relative jump instruction


(RJMP) transfers control to the START label.

[Course’s 30 [Course
name] number]
International School of Electrical
University Engineering
.ORG 0x002A ; Sets the reset vector to address
0x0000, indicating where the program execution begins after a reset.

START: ; A label indicating the start of the


program execution.

Ldi r19,0x66 ; Loads the hexadecimal value 0x66


into register r19.

Ldi r20,0x33 ; Loads the hexadecimal value 0x33


into register r20.

cp r19,r20 ; Compares the values in registers


r19 and r20.

breq IF ; If the comparison result is equal


(i.e., breq), the program branches to the IF label.

ELSE: ; A label indicating the start of the


ELSE section.

LDI R16 , 0x11 ; Loads the value 0x11 into register R16.

RJMP ENDIF ; Unconditional jump to the ENDIF label.

IF : ; A label indicating the start of the IF


section.

[Course’s 31 [Course
name] number]
International University School of Electrical Engineering

LDI R16 , 0x22 ; Loads the value 0x22 into register


R16.

ENDIF : ; A label indicating the end of the IF


section.

MAIN: ; A label indicating the


start of the main loop.

RJMP MAIN ; An infinite loop, causing


the program to repeatedly jump back to the MAIN label.

 The function of this program:


The assembly program creates an initial condition by loading two values into registers
and comparing them. Depending on the comparison outcome, it loads different values
into another register (R16) before entering an infinite loop. In this particular program: If
r19 equals r20 (0x66 == 0x33, which they do not), then R16 is set to 0x22. Otherwise,
R16 is set to 0x11 (since 0x66 ≠ 0x33). The program ends by jumping to the MAIN
label, resulting in an infinite loop that prevents further execution.

[Course’s name] 1 [Course number]


International University School of Electrical Engineering

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in Protues

3.9 Experiment 9

Write a Assembly program to monitor the PB3 bit. When it is LOW, send $38 to PORTC. If it is
HIGH, send $43 to PORTC.

Signature of Lab Instructor Remarks

Experiment Run in AVR Studio

Experiment Run in Protues

[Course’s name] 2 [Course number]


International University School of Electrical Engineering

3.10 Experiment 10

Write an Assembly program to control 32 LEDs connected to PORTA, PORTB, PORTC, and
PORTD with different Scenarios, using the Delay following function to delay the lighting time
of each LED.
Delay_1s:
LDI R20,68 ;
DL3: LDI R21,100 ;
DL2: LDI R22,48 ;
DL1: DEC R22 ;
BRNE DL1 ;
DEC R21 ;
BRNE DL2 ;
DEC R20 ;
BRNE
DL3

[Course’s name] 3 [Course number]


International University School of Electrical Engineering

[Course’s name] 4 [Course number]


International University School of Electrical Engineering

[Course’s name] 5 [Course number]


International University School of Electrical Engineering

3.11 Experiment 11

[Course’s name] 6 [Course number]


International University School of Electrical Engineering

[Course’s name] 7 [Course number]


International University School of Electrical Engineering

4 Discussion of Results

In conclusion, learning convolution via these three ways gives you a thorough understanding of
both the theoretical basis and practical applications in micro-processing systems. It also
improves my expertise in using AVR Studio and Proteus, allowing me to comprehend exactly
what the code is doing. Thank you to our teacher, M.Eng.V.M. Thanh, who was very helpful
during the lab session.

[Course’s name] 8 [Course number]

You might also like