1/148
Looks like no tags are added yet.
True or False: Microcontrollers are normally less expensive than microprocessors.
True
When comparing a system board based on microcontroller and a general-purpose microprocessor, which one is cheaper?
A microcontroller-based system
A microcontroller normally has which of the following devices on chip:
(A) RAM (B) ROM (C) I/O (D) ALL OF THE ABOVE
(D)
A general-purpose microprocessor normally needs which of the following devices attached to it?
(A) RAM (B) ROM (C) I/O (D) ALL OF THE ABOVE
(D)
An embedded system is also called a dedicated system. Why?
It is dedicated because it does only one type of job.
What does the term embedded system mean?
Embedded system means that the application and the processor are combined into a single system.
List some of the 8-bit microcontrollers
AVR, PIC, 8051, HCS08
Name three features of the AVR
64K of RAM space, 8M of on-chip ROM, a larger number of I/O pins, ADC, and different serial protocols such as SPI, USART, I2C, ect.
The AVR is a(n) -bit microprocessor
8
Name the different groups of the AVR chips
- tiny
- mega
- xmega
- classic
- special purpose
Which group of AVR has smaller packages?
tiny
Give the size of RAM in each of the following:
(A) ATmega32 (A) ATtiny25
(A) 2K bytes (B) 128 bytes
Give the size of the on-chip program ROM in each of the following
(A) ATtiny84 (B) ATmega328 (C) ATtiny25
(A) 8K bytes (B) 32K bytes (C) 2K bytes
TRUE or FALSE: The I/O registers are used for storing data?
False
The GPRs together with I/O registers and SRAM are called ________.
Data memory
The I/O registers in the AVR are_______-bit
8
The data memory space in AVR is divided into _______ parts
3
The data memory space in the AVR can have a maximum of _____ bytes
64K
The standard I/O memory space in AVR is _______ bytes.
64
Write an instruction to copy the value 0x34 into the R29 register.
LDI R29, 0x34
Write an instruction to add the values 0x16 and 0xCD. Place the result in the R19 register.
LDI R18, 0x16
LDI R19, 0xCD
ADD R19, R18
True or False: No value can be moved directly into the GPRs.
False
What is the largest hex value that can be moved into an 8-bit register? What is the decimal equivalent of that hex value?
FF hex and 255 in decimal.
The vast majority of registers in the AVR are __ bit
8
True or False: No value can be loaded directly into internal SRAM.
True
Write instructions to load value 0x95 into the SPL I/O register.
LDI R20, 0x95
OUT SPL, R20
Write instructions to add 2 to the contents of R18.
LDI R19, 2
ADD R18, R19
Write instructions to add the values 0x16 and 0xCD. Place the results in location 0x400 of the data memory.
LDI R20, 0x16
LDI R21, 0xCD
ADD R20, R21
What is the largest hex value that can be moved onto a location in the data memory? What is the decimal equivalent of the hex value?
FF in hex or 255 in decimal
"ADD R16, R3" puts the result in _____
R16
What does "OUT OCR0A, R23" do?
It copies the contents of R23 into the OCR0A I/O register.
What is wrong with "STS OCR0A, R23"? What does it do?
The OCR0A presents the I/O address of the OCR0A register($27); but we should use the data memory address while using the STS instruction. The instruction copies the contents of R23 into the location with the data memory address of $27 (the DDRC I/O register).
The flag register in the AVR is called __________________.
SREG
What is the size of the flag register in the AVR
8 bits
FIND the C,Z, and H flag bits for the following code:
LDI R20, 0x9F
LDI R21, 0X61
ADD R20, R21
(C = 1), (H = 1), and (Z = 1)
FIND the C, Z, and H flag bits for the following code:
LDI R17, 0x82
LDI R23, 0x22
ADD R17, R23
(C = 0), (H = 0), and (Z = 0)
FIND the C, Z, and H flag bits for the following code:
LDI R20, 0x67
LDI R21, 0x99
ADD R20, R21
(C = 1), (H = 1), and (Z = 1)
What is the purpose of pseudo-instructions?
The real work is performed by instructions such as LDI and ADD. Pseudo-instructions, also called assembly directives, instruct the assembler in doing its job.
____ are translated by the assembler into machine code, whereas ______ are not
The instruction mnemonics, pseudo-instructions
True or False: Assembly language is a high level language.
False
Which of the following produces opcode? list all that do
(A) LDI R16,0x25
(B) ADD R23, R19
(C) .ORG 0x500
(D) JMP HERE
All except (C)
Pseudo-instructions are also called ________
Assembler directives
True or False: Assembler directives are not used by the CPU itself. They are simply a guide to the Assembler.
True
Which one of these is an assembler directive?
(A) LDI R16,0x25
(B) ADD R23, R19
(C) .ORG 0x500
(D) JMP HERE
(C)
Give two ways for hex data representation in the AVR assembler.
.EQU DATA1 = 0x9F
.EQU DATA2 = $9F
Show how to represent decimal 99 in formats: (A) hex, (B) decimal, and (C) binary in the AVR assembler.
.EQU DATA1 = 0x99
.EQU DATA2 =99
.EQU DATA3 = 0b10011001
What is the advantage in using the .EQU directive to define a constant value?
If the value is to be changed later, it can be done once in one place instead of at every occurrence.
Show the hex number value used by the following directives:
(A) .EQU ASC_DATA = '4'
(B) .EQU MY_DATA=0B00011111
(A) $34 (B) $1F
Give the value in R22 for the following:
.EQU MYCOUNT = 15
LDI R22, MYCOUNT
15 in decimal (0x0F in hex)
Give the value in data memory location 0x200 for the following:
.EQU MYCOUNT = 0x95
.EQU MYREG = 0x200
LDI R22, MYCOUNT
STS MYREG, R22
value of location 0x200 = (0x95)
Give the value in data memory location 0x63 for the following:
.EQU MYDATA = 12
.EQU MYREG = 0x63
.EQU FACTOR = 0x10
LDI R19, MYDATA
ADD R19, FACTOR
STS MYREG, R19
$0C + $10 = $1C will be in data memory location $63
True or False: The Atmel Studio IDE and Windows Notepad text editor both produce ASCII files.
True
True or False: The extension for the source file is "asm".
True
Which of the following files can be produced by a text editor?
(A) myprog.asm (B) myprog.obj (C) myprog.hex
(D) myprog.lst
(A)
Which of the following files is produced by an assembler?
(A) myprog.asm (B) myprog.obj (C) myprog.hex
(D) myprog.lst
(B), (C), and (D)
In the AVR, the program counter is, at most, ______ bits wide.
22
True or False: Every member of the AVR family, regardless of the program ROM size, wakes up at memory $0000 when it is powered up.
True
At what ROM location do we store the first opcode of an AVR program?
0x0000
The instruction "LDI R20, 0x44" is a _____ byte instruction
2
The instruction "JMP label" is a _____ byte instruction
4
True or False: All the instructions in the AVR are 2 or 4 byte instructions.
True
What do RISC and CISC stand for?
RISC (Reduced Instruction Set Computer) and CISC (Complex Instruction Set Computer).
True or False: The CISC architecture executes the vast majority of its instructions in 2, 3, or more clock cycles, while RISC executes them in one clock.
True
RISC processors normally have a ______ (large, small) number of general-purpose regesters.
Large
True or False. Instructions such as "ADD R16, ROMmemory" do not exist in RISC microcontrollers such as the AVR.
True
How many instructions does the ATmega have?
Around 130
True or False: While CISC instructions are of variable sizes, RISC instructions are all the same size.
True
Which of the following operations do not exist for the ADD instruction in RISC?
(A) register to register (B) immediate to register (C) memory to memory
(C)
True or False: Harvard architecture uses the same address and data buses to fetch both code and date.
False
The mnemonic BRNE stands for
branch if not equal
True or False: "BRNE back makes the decision based on the last instruction affecting the Z flag
True
"BRNE HERE" is a ____ byte instrcution
2
In "BREQ NEXT" which registers content is checked to see if its 0s
Z flag of SREG
JMP is a ___ byte instruction
4
True or False. In the AVR control can be transferred anywhere within. the 4M of code space by using the call instruction
True
The call instruction is a ____ byte instruction
4
True or False. In the AVR control can be transferred transferred anywhere within the 4M of code space by using the call instruction
False
With each CAL instruction the stack pointer register SP is _________
decrement
with each return instruction the SP is _____
incrmeent
on powerup the SP points to adress
0
How deep is the size of the stack in the AVR
as big as its ram memory
the RCALL instruction is a ____ byte instruction
2
______ (RCALL, CALL) takes more ROM space
Call
True or false. In the AVR the machine cycle lasts 1 clock period of the crystal frequency
True
The minimum number of machine cycles needed to execute an AVR instruction is_______.
1
for question 2 what is the maximum number of cycles needed and for which instructions
4, CALL RET
FInd the machine cycle for a crystal frequency of 12MHZ
1/12 MHZ ? (idk about these)
question 5 is too long look it up if you care
:)
Trye or False in teh AVR the machine cycle lasts 6 clock periods of teh crystal frequecny
False (4 cycles)
Find the machine cycle for an AVR if the crystal frequency is 8 MHz
0.8 ms
TRUE or FALSE in the AVR the instruction fetching and execution are done at the same time
True
TRUE or FALSE JMP and RCALL will always take 3 machine cycles
TRUE
TRUE or FALSE the BRNE instruction will always take 2 cycles
False only if it branches to the target address
in unsigned byte by byte multiplication the product will be placed in registers
R1:R0
is "MUL r2, 0x10" a valid AVR instruction? explain
No because immediate addressing mode is not supported
In AVR, teh largest two numbers that can be multiplied are ____ and ____
255, 255
True or False the MUL instruction works R0 and R1 only
False
The instruction add r20, r21 places the result in ____
r20
Why is the following ADD instruction illegal? "Add r1, 0x04"
We cannot use immediate adressing mode with ADD
the instruction "sub R1, R2" places the result in ____
R1