Tải bản đầy đủ (.doc) (2 trang)

Bài tập Kỹ thuật vi xử lý - DTVT - BKDN (bài06)

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (51.96 KB, 2 trang )

CS/ECEn 124, W2012
Homework #6
MSP430 Assembler (Ch 7)
Stacks (Ch 8)

Name

Questions:

Answers:

Section

Score

/ 46

1. (18 points) What native MSP430 instruction is
replaced by the assembler for each of the
following emulated instruction?
a.
b.
c.
d.
e.
f.
g.
h.
i.
j.
k.


l.
m.
n.
o.
p.
q.
r.

ADC.W dst
DEC dst
DECD dst
INC dst
INCD dst
INV.B dst
RLA.W dst
RLC.B dst
CLR dst
CLRC
POP dst
SETZ
TST.B dst
BR dst
DINT
EINT
NOP
RET

2. (2 points) What MSP430 instruction could be
used for a 1 word, 2 cycle NOP?


3. (6 points) The following operations are
performed on a stack:
PUSH A, PUSH B, POP, PUSH C,
PUSH D, POP, PUSH E, PUSH F, POP,
POP, POP, PUSH F

a. What does the stack contain after the last
PUSH F?
b. At which point does the stack contain the
most elements?
c. Without removing any elements left on the
stack from the previous operations, what does
the stack contain after the following
additional operations?
PUSH G, PUSH H, PUSH I, PUSH J,
POP, PUSH K, POP, POP, POP,
PUSH L, POP, POP, PUSH M

BYU, ECEn/CS 124, W2012

Homework #6

Page 1/2


4. (10 points) How many cycles are used by each
of the following instructions:
a. mov.w r5,r6
b. mov.b r5,r6
c. add.b @r5,r6

d. add.b 10(r5),r6
e. sub.w 10(r5),20(r6)
f. mov.w #1,r5
g. mov.w #100,r5
h. jmp label
i. jne label
5. (4 points) Power consumption is directly
related to the number of instruction cycles used
by a system. Show and explain the difference in
power consumption between
a. adding a Program A (that uses a billion cycles
on startup and then another billion cycles once
per subsequent year) to a system, and
b. adding a single extra instruction cycle to an
existing Program B (which executes 1024 times
per second).
Explain your answer in terms of cycles per year.
6. (6 points) A watch crystal has a strange looking
frequency of 32,768 Hz (cycles/second). This
frequency is convenient for real-time clocks
because it is the largest positive value that can be
used with a decrementing 16-bit counter. When
the timer counts down to zero, one second has
expired.
a. John Harrison’s H4 chronometer (clock)
accumulated an error of 5.1 seconds over 81 days
when it was first taken to sea for testing in 1761.
A typical watch crystal has an error of 20 parts
per million (ppm). How many times more
accurate was Harrison’s clock than a watch

crystal controlled clock?
b. How accurate of a crystal is needed for a realtime clock (in parts per million error) in order to
be at least as accurate as Harrison’s clock?
(Hint: Read “Clock accuracy in ppm” found in
the Readings section of References.)
BYU, ECEn/CS 124, W2012

Homework #6

Page 2/2



×