Kristianstad University DT232A: Embedded Systems I
Examiner: Dawit Mengistu
Note:
Standard calculators are allowed
NO other help materials are allowed;
You can write your answers in English or/and Swedish Write your answers clearly.
The answer to each question should start on a new page.
No points will be given for unreadable answers
Use the information in the attached pages as references wherever applicable.
Date: 2015.11.06
1.
a)
Which two-input logical block generate the timing-diagram below?
(6 points)
(2)
b)
Place following function in the Karnaugh map
(4)
Simplify as much as possible.
2.
(5 points)
Design a sequential circuit that divides input frequency by 8 and shows the output on a 4-bit counter. Note: the output of the frequency divider is used as an input to the counter.
You can use your preferred flip-flop type for this purpose. You may use different types of flip-flops for the divider and the counter, if you wish.
3.
a)
b)
4.
a)
b)
5.
Explain the difference between Harvard and Von Neumann memory architectures. What are the advantages of Harvard over Von Neumann?
(6 points)
(1.5) (1)
The CPU contains different types of registers. Taking any processor you are familiar with (e.g. AVR, ARM, X86, etc.), describe the types (groups) of registers it has.
What is the purpose of each group of register? About how many registers does the processor have? (3.5)
(5 points)
Explain at least 3 disadvantages (problems) of dynamic memory (DRAM) compared with static
memory (SRAM).
Explain in detail the operation flow and sequence of the fetch-execute cycle.
(2)
(3p)
(5 points)
A typical I/O module of a computer can be described using the following diagram:
a) As you can see in the diagram, an I/O module has three types of registers: data, status, control. What are the functions of each register type? (3)
b) For addressing I/O units, we use two methods; memory mapped I/O and port mapped I/O. What is the difference between the two addressing methods? (2)
6. (5 points)
An embedded system designer wishes to build an embedded system to be installed in a manufacturing machine. The hardware of the embedded system contains an 8-bit CPU and the following memory chips (total 4):
Data memory (RAM) 3 modules (chips) size: 4KB each Program memory (ROM) 1 module, size: 2KB
7.
a)
b)
Design the addressing circuit and bus structure used to connect the CPU to the memory unit. Show a schematic diagram of your design with proper connections between the hardware components. (3)
Describe the resulting memory address map and additional hardware you need to realize the addressing unit. (2)
(7 points)
You are required to write an assembly program code for a weather station which is based on the ATMega168 microcontroller. Your code displays the total amount of rainfall in 2014. The total rainfall is the sum of the monthly rainfall data. Assume that:
– The 12-month rainfall data is already stored in consecutive memory as integer values.
– The starting memory address of the rainfall data is 0x1000 (e.g. January’s rainfall).
– The microcontroller has an 8-bit processor with 16MHZ speed
You should write an assembly program code that calculates the sum of the monthly rainfall data which is already stored in memory.
8.
a) b)
c)
Write an assembler code with proper comments to do the required task. (4)
How much time does it take to complete the execution of the above program? Justify your answer by showing the necessary calculations. (1.5)
How much flash memory is required to store your compiled code? Justify your answer by showing the necessary calculations. (1.5)
(6 points)
A toy factory wants to use a microcontroller based blinker (red and blue LED lamps) on one of its products. When a child presses the POWER ON button, the red and blue lights blink one after the other. Each LED lamp is switched on for a 2 seconds duration and switched off for the next 2 seconds. If the blue lamp is ON, the red lamp is OFF and vice versa.
Write a C program for this application. Use the following assumptions:
– You shall use the ATMega168 processor which has a speed of 16MHZ
– You shall use Timer0 to control the lighting interval.
Use a flow chart or relevant diagram in order to make your solution understandable. Write proper comments to describe your code.
1. Interrupt Address table
2. Timer Initialization Information
• TCNT0: Timer/Counter an 8-bit register, stores the current value of Timer0.
• TCCR0: Timer/Counter Control Registers, configures the operations of Timer0.
• OCRxA, OCRxB: Output Compare Registers store the preset values for output compare.
• TIMSK enables timer interrupts
• TIFR monitors status of timer interrupts. •
TCR0 (Timer 0)
CS2:0 (clock select prescaler)
000 None
001 clkI/0
010 clkI/0/8
011 clkI/0/64
100 clkI/0/8clkI/0/256
101 clkI/0/8clkI/0/1024
110 External clock on T0 (falling edge trigger)
111 External clock on T1 (rising edge trigger)
Waveform generation mode (WGM)
00 Normal
10 PWM, Phase Correct 01 CTC
11 Fast PWM
• TIMSK Timer 0 uses the Timer/Counter 0 Output CompareMatch Interrupt Enable (OCIE0) bit and the Timer/Counter 0 Overflow Interrupt Enable (TOIE0) bit.
OCIE0 (=1): Compare Match interrupt is enabled if the I-bit in the Status Register is set (=1) TOIE0 (=1): Overflow interrupt is enabled if the I-bit in the Status Register is set (=1).
• TIFR Timer 0 uses
– the OCF0 bit position, (sets for an output compare match).
– the TOV0 bit position, (sets when Timer/Counter 0 Overflows).