Trying microcontroller code, Exercises of Art

how to code using microcontroller, using visual studio

Typology: Exercises

2019/2020

Uploaded on 11/09/2020

Abacus_tremary
Abacus_tremary 🇺🇸

4

(1)

1 document

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Computer System Architecture [
Lab 4 : Examining the Flags
]
Laboratory 5
Examining the Flags
Grade
Name:
Instructor:
Date:
Lab Objective:
Page 1
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Trying microcontroller code and more Exercises Art in PDF only on Docsity!

Laboratory 5 Examining the Flags Grade Name: Instructor: Date: Lab Objective:

  • To examine the flag bits of the SREG Material:
  • AVR Studio Reference:
  • Mazidi and Naimi “The AVR Microcontroller and Embedded Systems,” Activity 1: Write and assemble a program to add the following data and then use the simulator to examine the C, H and Z flags after the execution of each addition. $92, $23, $66, $87, $F

Write and assemble a program to load a value into each location of R20 – R23. Use the COM instruction to complement the value in each register. Use the simulator to single-step and examine the flags and register content after the execution of each instruction. .INCLUDE "M32DEF.INC" LDI R20, LDI R21,0xFF LDI R22,0x LDI R23,0x COM R COM R COM R COM R L1: RJMP L

Answer 4:

  • (a) LDI R20, $ Find the value of the C flag after the execution of the following codes.
    • LDI R21, $
    • ADD R20, R
  • (b) LDI R16, $
    • LDI R17, $
    • ADD R16, R
  • (c) LDI R25, $F
    • LDI R26, $
    • ADD R25, R
    • INC R (d) LDI R25, $FE
      • INC R
  • Prepared by: Aldrin J. Soriano, CpE, ECT Page
  • Prepared by: Aldrin J. Soriano, CpE, ECT Page
  • Prepared by: Aldrin J. Soriano, CpE, ECT Page
  • Prepared by: Aldrin J. Soriano, CpE, ECT Page