IT 441 Midterm Exam
Monday, October 28, 2002
Multiple Choice. 3 points each. Select the single best answer for each question.
1. The standard high and low priority interrupt vectors in the PIC 18F452 are spaced
10h bytes a
part. This is because.
The 10h byte space allows for a short routine starting at the vector address. A
longer routine could be called from the vector address.
Interrupt service routines are written at the vector address and cannot be more
than 10h bytes
The interrupt vector uses three bytes to specify the address of the routine. The
vectors are arbitrarily spaced on 10h memory boundaries.
The address of an interrupt routine requires 10h bytes to specify.
2. A major benefit of the Harvard Archi
word instructions execute more quickly than multi
Code and data share memory and increase hardware efficiency
Interrupt latency time is very predictable because instructions execute in a
Code and data can
be loaded into the CPU simultaneously on separate
3. What percentage of embedded systems are built with no or custom
31% or more
4. The “rule of ten” means that
it takes ten times longer to develo
p code in assembler than in high
languages such as C.
if it costs $1 (labor) to fix a bug while coding it could easily cost $1000 to fix
that same bug after the product has shipped
you should have at least one comment for every ten lines of source co
the power of computing systems increases by a factor of ten every two years.
the power of computing systems increases by a factor of two every 10
5. What is the difference between a simulator and an emulator in embedded system
simulator runs in the target system while an emulator runs in the
A emulator runs in the target system while an simulator runs in the
A simulator is intended for assembly language testing while an emulator is
There is no practical difference. Different companies name these similar tools
with different names
6. A “watch
dog timer” enables the implementation of real
time systems by providing
a timer used by dog breeders to train police dog
a regularly timed interrupt for starting real
a very flexible interrupt which is set for individual, critical real
day alarm to synchronize all tasks at a fixed time.
a mechanism for the safe shut
down of a system if any
task takes too long to
a timer triggered by an external interrupt or signal coming into the system.
7. What is the “volatile” keyword is used for in C programming of embedded systems?
To indicate that the memory being used is RAM rather than
medium such as ROM or flash.
To indicate that the program can be modified while it is running.
To indicate that the variable designated by volatile could be changed by an
input not under program control.
To designate an interrupt routine activa
ted by a hardware signal
8. A simple DC motor is to be controlled by an embedded system using a pulse width
modulation system. The motor speed will be the highest when
The off period of the pulse is at a maximum compared to the on period.
The on period
of the pulse is at a maximum compared to the off period.
The frequency of the pulse train is highest.
The frequency of the pulse train is lowest.
9. A cross
compiler is used to
level language code to assembler code
Convert one high
anguage to a different high
Compile code for a target CPU that is different from the development CPU
Combine both high
level language and assembler into a single module
Section B. Short questions and problems.
1. The addresses of the PIC
18F452 that the following interrupt types (vectors) use are:
(2 points each)
2 (2). What are the two most signific
ant parameters to be aware of when evaluating
Analog to digital converters?
b. Sampling Frequency
* Sample and hold
3. The features that define a RISC system are:
ect all correct statements. 2 points
1 each incorrect answer)
A wide range of assembly instructions are available including floating point
The data memory and program memory are connected to the CPU using
tions execute in one instruction cycle
Any RISC system is faster than any CISC system
The data word size is the same as the instruction word size.
“Multiply” instructions are not permitted on RISC systems
RISC systems can only be used in embedded systems,
they cannot be used
in desktop systems.
The system has a relatively small set of instructions which can be used
to build up more complex instructions (subroutines). These more
complex routines will take several cycles to execute.
RISC systems always have
only one accumulator and do not have other CPU
registers for indexing, arithmetic, stack etc.
The time elapsed before an interrupt is serviced (interrupt latency) can
be very accurately predicted.
4.(4) Assume that FSR1H is loaded with 0x00 and FSR1L is
loaded with 0x34. What
will the following instruction do? Use SFR names and addresses as appropriate.
Clears INDF1 and increments the pointer.
5. A Digital to Analog converter is to be built using an R/2R ladder, op
amp and 10
logue switch. The output (analog) voltage range is
5V to +5V
a. (4) What is the smallest voltage increment that this device is capable of? Show
Vmin = 1/1024 * Vref
Vmin = 1/1024 * 10 = 0.009765625 V
b. (4) What is the bene
fit of an R/2R ladder design over a series of resistors with values
R, 2R, 4R, ... 2
It would be difficult to get an inline resistor package that would allow for this.
Furthermore the calculations would be more complex.
Odd resistor values.
3) The software for this D/A system will output
10 bit values proportional to the magnitude of the desired voltage
10 bit values proportional to the frequency of the desired voltage
Bit patterns indicating the next rotary position of the motor to be contro
10 single bits in sequence for each new motor position
10 single bits in sequence for each new motor speed
time embedded (RTE) system testing has special challenges compared to
testing of normal, desk
computer based software. All so
ftware must be checked for
syntax and algorithmic correctness. In addition RTE software must also consider other
important factors such as:
(i)How much time it takes to complete a complex task
(ii)How do you monitor your system, indicator light
s output. How do you use I/O
that you have available
(iii)Power consumption, how much power are you using to perform a task.
7. (8) Calculate the necessary values to configure a PIC18F452 serial port. The system
oscillator is 30 MHz. The desired ba
udrate is 38.4 Kbps. Calculate the necessary
SPBRG and BRGH values for the lowest error. State the error as a percentage.
Desired baud rate = Fosc / (64 ( x + 1))
X = (Fosc / Desired Baud Rate) / 64)
X = (30000000 / 38400) / 64
X = 11.
Calculated Baud rate = 30000000 / (64 (11 + 1))
38400) / 38400 = 0.017252604166666666666666666666667
With BRGH high
X = [(fosc / desired baud rate) / 16 ]
X = ( 30000000 / 38400 ) / 16
X = 47.828125
Baud rate = 30000000 / (16 ( 48 + 1))
38400 ) / 38400 =
BRGH high with
SPBRG = 48
Error of 0.35%
8. (3) The PIC18Cxxx has an “Access
Bank” with general Purpose Registers (GPR) and
Special Function Registers (SFR). Where in the memory banks is the Access bank
Technically the access bank is located in the lower half of bank zero 000h
and the upper half of bank 15 F80h
9. (6) Assume you wish to develop a system involving a few digital I/O using an PIC
18F452 chip. What components and development tools do you need? Do not assume
you have a lab full of stuff available. Assume you are in a new start
electric power and a standard PC desktop machine and normal office supplies.
Assume you have a stock of 18F452 chips. List the most important things you would
need to design and bring up a working microcontroller.
it that connects to the computer and
programs the Flash chip
MPLAB development environment.
Documentation, the data sheet would be needed.
An emulator would be great but is not required.
A prototype board system. Some system where you can either
wirewrap the embedded device to the appropriate inputs and
outputs, or use a breadboard.
Powersupply for the prototype board.
Switches and other devices you would like to interface with
zer would be nice.
Background: You have been hired as the chief system designer for a new start
company. The company is designing and building embedded systems for device that
will be built into a family
room table and be used with a to
screen for playing board
games (electronic monopoly, chess, checkers etc.), providing news, traffic and weather
updates, allow ordering snack food (pizza etc.) and videos over the internet (to be
played on a different TV/VCR system), and use sensors to
monitor whether people are
in the room, outside weather conditions, control inside heating and cooling.
The unit acts as an independent battery
powered system and uses wireless Internet
connections so the table can be easily moved.
A. (4) Would you u
se an operating system for this application? (zero points)
choice (all the points).
There is absolutely no reason to go re
inventing the wheel here. If there is an
imbedded operating system such as uClinux that you can use and it alread
the abilility to connect to the internet then there is no reason to go and make one
of your own.
Further, you want your system to be user friendly, most operating systems that
are built up on embedded systems are very limited an not very user fri
It seems like you will be doing a lot of development and testing and the benefits
that an operating system will give you far outweigh the drawbacks.
B. (2) You have a choice of a fast clock (1.8 GHz MHz) or a slow one (100 MHz). You
ate the load on the system and estimate that either one has sufficient processing
power for the intended applications. Would you choose the fast or the slow one? (zero
your choice in just a few words. (all the points).
100 Mhz = l
ess power consumption
This is battery powered so we have to be concerned with that.