Professional Documents
Culture Documents
https://testbankfan.com/download/atmel-avr-microcontroller-mega-and-xmega-in-asse
mbly-and-c-1st-edition-han-way-huang-test-bank/
TRUE/FALSE
ANS: F PTS: 1
REF: 2.2 An Overview of the AVR Microcontroller Family
2. The V bit (Two’s Complement Overflow flag) of the status register indicates whether an overflow
occurs in the previous operation.
3. Direct Data Addressing Mode uses the contents of one of the pointers (X, Y, or Z) to specify the
address of the data memory location to access.
4. The arithmetic and logic instructions of the AVR cannot use memory locations as their operand. The
value stored in a memory location must be copied to a register before it can be operated on.
5. The AVR has a version of the SUB instruction that can be used to perform multiprecision subtraction
operations.
COMPLETION
1. An AVR instruction can be divided into two parts: the ____________________ and
____________________ fields.
ANS:
opcode operand
operand opcode
2. The ELPM instruction uses the Z pointer to specify the program memory location to access. When the
ELPM instruction is used, the ____________________ register is used to extend the Z pointer.
ANS: RAMPZ
3. The subtraction instruction that subtracts the constant k (0 <= k <= 63) from the register pair Rd+1:Rd
and places the difference in Rd+1:Rd (Rd is 24, 26, 28, or 30) is called ____________________.
ANS:
sbiw Rd, k
4. The lpm (load program memory) instruction loads the contents of the program memory location
pointed to by Z to register ____________________.
ANS: r0
ANS: 32
SHORT ANSWER
1. Briefly describe the memory size, the number of instructions supported, and the maximum clock
frequencies of the Mega and XMega devices.
ANS:
The Mega devices have from 4 to 256 kB of program flash memory, support most of the AVR
instructions (130-135), and have a maximum clock frequency of 20 MHz. The XMega devices have
from 32 to 384 kB of memory, implement all 142 instructions, and may run at a clock with a frequency
as high as 32 MHz.
2. Name four of the bits in the status register (SREG) and describe their functions.
ANS:
1. The Global Interrupt Enable Flag (I). This flag must be set to 1 in order for each individual interrupt
source to be enabled. When it is cleared to 0,none of the individual interrupt sources are enabled.
2. Bit Copy Storage (T). This flag is used by the bit load and bit store instruction as the source or
destination operand bit.
3. Half Carry Flag (H). The half carry flag indicates a half carry in some arithmetic operations.
4. Sign bit (S). This flag indicates the sign of the previous operation result and is always the exclusive
OR of the N and V flags.
5. Two’s Complement Overflow Flag (V). This flag indicates whether an overflow occurs in the
previous operation.
6. Negative flag (N). This flag indicates whether the previous arithmetic or logical operation is
negative.
7. Zero Flag (Z). This flag indicates whether the previous arithmetic or logical operation result is zero.
8. Carry Flag (C). This flag indicates whether a carry is generated in the previous arithmetic or logical
operation.
ANS:
Atmel AVR Microcontroller MEGA and XMEGA in Assembly and C 1st Edition Han-Way Huang Test Ba
The XMega AVR devices provide this register to support direct addressing of the whole data memory
space above 64 kB. This register is concatenated with the k operand in the instruction. The content of
this register and the k field in the instruction are used as the direct address to access data memory.
4. Some complex AVR devices have more peripheral registers than can be supported within the 64
locations reserved in the instruction for I/O direct addressing. How can this extended I/O memory be
accessed?
ANS:
The extended I/O memory can only be reached by using the data memory addressing. I/O registers in
the extended I/O memory space must be accessed using load (LD/LDS/LDD) and store (ST/STS/STD)
instructions.
5. Name three AVR addition instructions described in this chapter and give a brief description of each.
ANS:
1. add Rd, Rr. (Add without carry) This instruction add the contents of registers Rd and Rr and places
the sum in Rd.
2. adc Rd, Rr. (Add with carry) This instruction adds the values in Rd and Rr and the C flag of the
SREG register, and places the sum in Rd.
3. adiw Rd, k. (Add immediate to word) This instruction adds the constant k (0-63) to the register pair
Rd+1:Rd and places the sum in the register pair Rd+1:Rd. Here, Rd can only be 24, 26, 28, and 30.
Cereal-gods, 12
Cosmogony, 36–64
[Contents]
Day-gods, 362–3
[Contents]
[Contents]
[Contents]
H
[Contents]
Interpretative Codices, 8
Itztli, 336–7
[Contents]
[Contents]
Monachism in Mexico, 9, 10
Nagualism, 18
Nahuatl language, 2
Nanahuatzin, a deity, 43
[Contents]
Omacatl, 352–3
[Contents]
P
[Contents]
[Contents]
[Contents]
[Contents]
Tecciztecatl, a moon-god, 43
Tonalamatl, the, a book of fate and fortune. See Appendix, 359 ff.;
nature of, 359–60;
day-signs of, 360–1;
in tabular form, 361–2;
day-gods of, 362–3;
gods of the “weeks,” 363;
“Lords of the Night,” or Acompañados, in, 364;
lords of the day-hours in, 365;
festivals included in the, 366;
recapitulation of information regarding the, 366;
solar calendar and the, 367;
names of the years, 368;
the calendar-round, 368–9;
the nemontemi, 369–70;
Venus period and the, 370;
bibliography of the, 373
Totemism, 17–18
[Contents]
[Contents]
[Contents]
[Contents]
[Contents]
[Contents]
This eBook is for the use of anyone anywhere at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it under the terms
of the Project Gutenberg License included with this eBook or online at
www.gutenberg.org ↗️.
Metadata
Revision History
2023-07-23 Started.
Corrections
1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside
the United States, check the laws of your country in addition to
the terms of this agreement before downloading, copying,
displaying, performing, distributing or creating derivative works
based on this work or any other Project Gutenberg™ work. The
Foundation makes no representations concerning the copyright
status of any work in any country other than the United States.
1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if
you provide access to or distribute copies of a Project
Gutenberg™ work in a format other than “Plain Vanilla ASCII” or
other format used in the official version posted on the official
Project Gutenberg™ website (www.gutenberg.org), you must, at
no additional cost, fee or expense to the user, provide a copy, a
means of exporting a copy, or a means of obtaining a copy upon
request, of the work in its original “Plain Vanilla ASCII” or other
form. Any alternate format must include the full Project
Gutenberg™ License as specified in paragraph 1.E.1.
• You pay a royalty fee of 20% of the gross profits you derive from
the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”
• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.
1.F.