Quiz 2:
Q1.
DT131C: Embedded Systems Programming Computer Organization and Assembly Programming
a) Explain at least 3 disadvantages (problems) of dynamic memory (DRAM) compared with static memory (SRAM).
b) 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
a) 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.
b) Describe the resulting memory address map and additional hardware you need to realize the addressing unit.
Q2.
Write assembly code to perform the following tasks on ATMega328 microcontroller.
i) Send the decimal value 45 to output via port D
ii) Add two 8-bit integers on registers R0 and R1 (e.g. 45 + 35)
iii) Get the numbers to be added as in (ii) above from SRAM address 0210H and 0220H, perform addition and store the sum at address 0230H.
iv) Send the number 30H to PORTD if R0 contains the value 50. Otherwise send the number 70H to PORTD.
v) Find the sum of the first positive integers under 15.
vi) Modify the example in (v) above such that a sub routine called dataout is used to send the sum to output (PORTD).
Additional Exercises:
i) Write a sub routine called intadder that returns the sum of the first N numbers. N is read from SRAM at address 0120H.
ii) Write a program that calls intadder to add the integers and displays the result using the subroutine dataout above.
iii) Write a program that copies the first 10 bytes of data
Q1.
a) Explain the difference between Harvard and Von Neumann memory architectures.
b) What are the advantages of Harvard over Von Neumann? How about the other way?
Q3.
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 2019. 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.
a) Write an assembler code with proper comments to do the required task.
b) How much time does it take to complete the execution of the above program? Justify your answer by showing the necessary calculations.
c) How much flash memory is required to store your compiled code? Justify your answer by showing the necessary calculations.
Q4.
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?
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?