
ECE 331 Spring 2009 Homework 10 -Solution
1. A memory system contains 18 address lines and 16 data lines. Specify:
a) number of addressable memory locations = 2m = 218 = 262,144 = 256K
b) memory width = # data lines = 16 bits
c) memory length = # of memory bytes = 218 = 262,144 = 256K
d) memory size in bytes = 218 = 262,144 = 256K
e) memory size in bits = # bytes * bytes/bit = 262,144 * 16 = 4,194,304 =
4Mbits
2. Consider a microcontroller timer unit with a 16-bit counter operating with a 1MHz clock:
a) What is the maximum count value (in decimal) of the counter?
216 = 65,536 = 64K
b) How long will it take for the counter to overflow?
216 = 65,536 = 64K
c) If the counter is used to time a 10 second event, how many times will the counter overflow
and what is the value (in hex) in the counter after 10 seconds? Assume the counter starts
at $0000.
1MHz 1 µ sec/count. 65,536 counts will take 65.536msec.
In 10 sec, the counter will overflow 10/(65.536m) = 152.59 152 times
The time taken for 152 overflow cycles is 152(65.536msec) = 9.661472 sec
(notice that here we MUST keep track of all the digits after the decimal)
The time remaining to count in the 153rd cycle is 10 - 9.661472 = 38.528msec
The count during the 153rd cycle would be 38.528m/1µ = 38,528 = $9680.
d) Repeat part c) if the counter is initially at $F0F0.
By inspection, this would cause the counter to overflow one additional time.
The counter value on the 154th cycle would be:
$F0F0 + $9680 = $18770, where the first digit represents the additional
overflow. Thus, the counter would hold $8870.