-
Thông tin
-
Hỏi đáp
Introduction to AVRStudio | Bài báo cáo thực hành Lab 1 học phần Micro-processing Systems Laboratory | Trường Đại học Quốc tế, Đại học Quốc gia Thành phố Hồ Chí Minh
In the first command, we used the LDI operation to set the value of R17 to 103 (in decimal) and 0x67 (in hexadecimal). Next, we set the value of R17 to 0b00110101 (in binary) and 0x35 using the LDI operation (in hex). We then set the value of R17 to 0xC6 using the LDI operation (in hex). Then, using the ANDI logical AND procedure between 0xC6 and 0x65, R20 = 0x44. From the first command to this stage, all SREG has been set to 0. We then set the value of R17 to 0x7A using the LDI operation (in hex). From the first command to this stage, all SREG has been set to 0. Tài liệu giúp bạn tham khảo, ôn tập và đạt kết quả cao. Mời bạn đón xem.
Micro-processing Systems Laboratory 1 tài liệu
Trường Đại học Quốc tế, Đại học Quốc gia Thành phố Hồ Chí Minh 695 tài liệu
Introduction to AVRStudio | Bài báo cáo thực hành Lab 1 học phần Micro-processing Systems Laboratory | Trường Đại học Quốc tế, Đại học Quốc gia Thành phố Hồ Chí Minh
In the first command, we used the LDI operation to set the value of R17 to 103 (in decimal) and 0x67 (in hexadecimal). Next, we set the value of R17 to 0b00110101 (in binary) and 0x35 using the LDI operation (in hex). We then set the value of R17 to 0xC6 using the LDI operation (in hex). Then, using the ANDI logical AND procedure between 0xC6 and 0x65, R20 = 0x44. From the first command to this stage, all SREG has been set to 0. We then set the value of R17 to 0x7A using the LDI operation (in hex). From the first command to this stage, all SREG has been set to 0. Tài liệu giúp bạn tham khảo, ôn tập và đạt kết quả cao. Mời bạn đón xem.
Môn: Micro-processing Systems Laboratory 1 tài liệu
Trường: Trường Đại học Quốc tế, Đại học Quốc gia Thành phố Hồ Chí Minh 695 tài liệu
Thông tin:
Tác giả:
Tài liệu khác của Trường Đại học Quốc tế, Đại học Quốc gia Thành phố Hồ Chí Minh
Preview text:
International University
School of Electrical Engineering
Micro-processing Systems Laboratory EE084IU Lab 1
Introduction to AVRStudio Submitted by Hoang Anh Khoa EEACIU18035
Nong Nguyen Hoang Tram EEACIU18128 Date Submitted: 30/03/2021 Date Performed: 23/03/2021 Lab Section: lab 1 Course Instructor: Nguyen Minh Thien
GRADING GUIDELINE FOR LAB REPORT
International University 1 EE084IU School of EE Number Content Score Comment Format (max 9%) - 1 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 2 EE084IU School of EE TABLE OF CONTENT
Theoretical Background --------------------------------------------------------------------------------------------- 3
Experimental Procedure -------------------------------------------------------------------------------------------- 3
1. Problem 1 -------------------------------------------------------------------------------------------------------- 3
2. Problem 2 -------------------------------------------------------------------------------------------------------- 4
3. Problem 3 -------------------------------------------------------------------------------------------------------- 4
4. Problem 4 -------------------------------------------------------------------------------------------------------- 5
Experimental Results ------------------------------------------------------------------------------------------------ 6
1. Problem 1 -------------------------------------------------------------------------------------------------------- 6
2. Problem 2 -------------------------------------------------------------------------------------------------------- 6
3. Problem 3 -------------------------------------------------------------------------------------------------------- 6
4. Problem 4 -------------------------------------------------------------------------------------------------------- 7
Discussion of Results ------------------------------------------------------------------------------------------------ 8 LIST OF TABLES
Table 1. List contents of the R20 and SREG 4
Table 2. List contents of the R20 and SREG 5
Table 3. Result of problem 2 6
Table 4. Result of problem 3 6
Table 5. Result of problem 4 7 Theoretical Background
Experimental Procedure 1. Problem 1
Follow step by step the AVR Studio tutorial
International University 3 EE084IU School of EE 2. Problem 2
List contents of the R20 and SREG (Status) registers for each line of the following program. mnemonic [operands] ser r20 dec r20 dec r20 subi r20, -7 inc r20 neg r20 com r20 clr r20
Table 1. List contents of the R20 and SREG Code for Problem 2 .include “m32def.inc” ser r20 dec r20 dec r20 subi r20, -7 inc r20 neg r20 com r20 clr r20 3. Problem 3
List contents of the R17 and SREG (Status) registers for each line of the following program. mnemonic [operands] ldi r17 ldi r17, 0b00110101
International University 4 EE084IU School of EE ldi r17, 0xC6 andi r17, 0x65 ldi r17, 0x7A cpi r17, 0x7FF subi r17, 0xFF
Table 2. List contents of the R20 and SREG Code for problem 3 .include “m32def.inc” Ldi r17, 103 Ldi r17, 0b00110101 Ldi r17, 0xC6 Andi r17, 0x65 Ldi r17, 0x7A Cpi r17, 0xFF Subi r17, 0xFF 4. Problem 4
Analyze the following code. Observe how the port I/O pins behave if this code was
downloaded to and running on the micro-contronller. Code for problem 4 .include “m32def.inc” LDI R16, 0xFF OUT DDRC, R16 Loop: LDI R16, 0x00 OUT PORTC, R16 LDI R16, 0xFF OUT PORTC, R16 RJMP Loop
International University 5 EE084IU School of EE
Experimental Results 1. Problem 1
By following step by step the AVR tutorial, we learn how to carry out basic function of AVR studio compiler. 2. Problem 2 mnemonic [operands] [;comment] I T H S V N Z C ser r20 R20 $FF - - - - - - - - dec r20 R20 $FE - - - 1 0 1 0 - dec r20 R20 $FD - - - 1 0 1 0 - subi r20, -7 R20$04 - - 0 0 0 0 0 0 inc r20 R20 $05 - - - 0 0 0 0 - neg r20 R20 $FB - - 1 1 0 1 0 1 com r20 R20 $04 - - - 0 0 0 0 1 clr r20 R20 $00 - - - 0 0 0 1 -
Table 3. Result of problem 2 3. Problem 3 mnemonic [operands] [;comment] I T H S V N Z C ldi r17, 103 R17 $67 - - - - - - - - ldi r17, R17 $35 - - - - - - - - 0b00110101 ldi r17, 0xC6 R17 $C6 - - - - - - - - andi r17, 0x65 R17 $44 - - - 0 0 0 0 - ldi r17, 0x7A R177A - - - - - - - -
International University 6 EE084IU School of EE cpi r17, 0xFF R17 $7A - - 1 0 0 0 0 1 subi r17, 0xFF R17 $7B - - 1 0 0 0 0 1
Table 4. Result of problem 3 4. Problem 4 OPERATION
VALUE OF R16 I T H S V N Z C LDI R16,0xFF 0xFF 0 0 0 0 0 0 0 0 OUT DDRC, R16 0xFF 0 0 0 0 0 0 0 0 LDI R16, 0x00 0x00 0 0 0 0 0 0 0 0 OUT PORTC, R16 0x00 0 0 0 0 0 0 0 0 LDI R16,0xFF 0xFF 0 0 0 0 0 0 0 0 OUT PORTC, R16 0xFF 0 0 0 0 0 0 0 0 LOOP RJIMP LOOP 0xFF 0 0 0 0 0 0 0 0
Table 5. Result of problem 4
International University 7 EE084IU School of EE
Discussion of Results 1. Problem 2
The code is executed completely by the Atmel Studio software. The registers receive
accurate addresses and data as I predict. The status registers (SREG) are also compatible
with the instruction set manual provided for ATmega32. 2. Problem 3
- In the first command, we used the LDI operation to set the value of R17 to 103 (in decimal) and 0x67 (in hexadecimal).
- Next, we set the value of R17 to 0b00110101 (in binary) and 0x35 using the LDI operation (in hex).
- We then set the value of R17 to 0xC6 using the LDI operation (in hex).
- Then, using the ANDI logical AND procedure between 0xC6 and 0x65, R20 = 0x44. From
the first command to this stage, all SREG has been set to 0.
- We then set the value of R17 to 0x7A using the LDI operation (in hex). From the first
command to this stage, all SREG has been set to 0.
- After that, we used the CPI process. This instruction compares register R17 with register
0xFF. Other bits were set to 0 except for H and C.
- Next, we subtracted the value of R17 by 0xFF R17 = 0x7B N (the negative flag) = 0 and S
(the sign bit) = 0 using the SUBI instruction. A carry out from the D7 bit C (the carry flag)
=1 was observed. D3 and D4 all carried H (the half-carry flag) = 1. Other bits are set to zero. 3. Problem 4
- The value 0xFF switches port C to read mode (via DDRC operation). The 0x00 and 0xFF loop is repeated on Port C.
- We discovered that by constructing the code, uploading it to the microcontroller, and
attaching 8 LEDs to port C, the LEDs were constantly turning on and off.
International University 8 EE084IU School of EE