Digital Electronics and Microprocessors, XMUT 2024
Assignment 1
Due 14 April , 19 pm (Xiamen Time)
Note: This assignment is individual. You must not work in groups.
Resources and links:
To Submit:
-
assignment1.pdf
(Your answers must be submitted online in one PDF file)
Instructions:
Note: Attempt all questions.
The answers to these questions can be found in the lecture slides, the Keil µVision user manual, the datasheets included with the laboratory scripts, or in 8051 Microcontrollers: Fundamental Concepts, Hardware, Software and Applications in Electronics by Salvador Pinillos Gimenez.
Your answers can be neatly handwritten, and any figures or schematics can be hand drawn. You can type your answers and/or submit electronic drawings if you prefer. However, it is strongly suggested that you first do a draft version and then complete your final, neat version when satisfied.
Note: The assignment is good practice for the test, for how you will work through the problems and the time you’re taking to complete them.
Question 1. Architecture
- What high-level computer architecture makes use of shared data and program memory?
- What high-level computer architecture makes use of separate data and program memories?
- What does CISC stand for, and is the 8051 an example of a CISC system?
- In a standard 8051, how many clock cycles result in one machine cycle?
- Given a 40 MHz crystal, find the time (in μs) required for one machine cycle.
- Given a 12 MHz crystal, find the time (in μs) required for one machine cycle.
Question 2. Architecture
- In a CPU, what does ALU stand for?
- In the 8051, what is an alternative name for Register A?
- In the 8051, how many bits is Register A?
- In the 8051, what register holds the address of the next instruction to be executed?
- What is 0d16 in hexadecimal?
- What is a larger numerical value: 0d128 or 0xFF?
- What is a smaller numerical value: 0b10000000 of 0xFF?
- Circle or underline the lower nibble of this 8051 byte: 0b10101010
- On the 8051, what does the NOP instruction do?
- On the 8051, what does the INC instruction do?
- What does the DA instruction do on the 8051?
- Below is a sequence of instructions, giving the result of the accumulator before and after the DA instruction.
MOV A,#13H
MOV R2,#18H
ADD A, R2
DA A
Question 3. Memory
- What is the space in bytes that is reserved for storing each interrupt service routine in the C8051F020? What would you do if the code of an interrupt service routine is larger than the available space? Assume you need to use the following interrupt service routine. RESET, INT0, Timer0, INT1, Timer1, UART.
- What is the internal data memory structure of the 8051 microcontroller? Explain each memory part. Which area is bit-addressable? Which area is only accessible using direct addressing?
- What is the next available memory where the user can write a program without interfering with the interrupt vector? Give an example of program code.
Question 4. Timer
- Describe how you would implement a 20ms delay using timer 0. Assume the clock into the timer is 1MHz.
- What is the vector address of Timer 1?
Question 5. Writing assembly code.
Design software for the C8051F020(8051) in Assembly language using approximately ten lines of code. The code should execute an addition operation between the contents of the memory location, whose address is given by the value of the register R0, and the content of the memory location, whose address is 7Ah. After, the value contained in R4 must be subtracted from the result. Later, the result must be rotated 2 bits to the right. Save the value of the current register bank. The result must be stored in the R3 register of register bank 2. Load the saved register bank.
Question 6. Analog to digital conversion.
- Draw up a comparison table of the flash ADC, staircase ADC, and successive approximation ADC. Compare them in terms of the engineering trade-off between complexity, cost, and speed.
- A thermocouple (temperature sensor) has an output of 0 to 3.3 V over a measuring range of 0 to 800 °C.
- Calculate by how much the output of a 12-bit ADC with a 0 to 5 V input range would change over the full input range of the thermocouple.
- What would the temperature resolution of this system be?
- What would the temperature resolution be if a 16-bit ADC was used?