COMP2121 Microprocessors and Interfacing

COMP2121 Microprocessors and Interfacing
20T1 Final Project: Microwave Oven Simulator
Write a report on how you would design a microwave oven simulator that adheres to the given specification (on page 3). Your report should be around eight pages. Note that this work is to be done individually. Submit the report as a PDF file using GIVE before 24th April 2020 8.00 pm. Command give cs2121 assignment filename.pdf or use the GIVE web interface.
Assume that a development board like the one used in COMP2121 labs (with an AVR2560 microcontroller running at 16 MHz) and the necessary hardware components are given. For this project, you do not need to write actual assembly code or get a functioning simulator working on the development board. Instead, you must do the conceptual design and development, i.e. you must explain how you would do the design and development with the aid of diagrams, calculations and pseudo code.
The report should contain the following sections:
• Introduction
o Briefly explain what you trying to achieve
o Briefly explain key points in design and development o Justify key design decisions you made
• Hardware design
o How do the pins in the 2560 microcontroller connect to the external
component (such as LEDs, LCD, motor etc)?
o Which internal hardware modules (timer0, timer1…, PWM, ADC, UART, I/O
ports etc) of the microcontroller did you use? For what purpose did you use
each of them and why?
o What will be the configuration values you would write to corresponding
configuration registers of each of those hardware modules? Show any
computations if any.
o Which types of memory will you use (program memory, data memory,
EEPROM) and for what? How many bytes are required in each type of memory
and which data structures reside in which type of memory? • Software Design
o The high-level diagram that shows the connection between input, data structures, tasks and outputs (example given in the figure below)
o Which interrupts will you use and for which purpose will you use each?
o Writepseudocodeforthoseinterrupts.Seeexamplepseudocodegivenbelow. Note that you are free to write pseudocode in whatever style you would
prefer, as long as it will make sense to someone else.
o How would you modularise the design into functions and/or macros? o Write pseudo code for those functions and/or macro.
o Write the pseudo-code for the main function.

Programming Help, Add QQ: 749389476
store requests
How data is stored?
Figure: Example high-level diagram that shows the connection between input, data structures, tasks and outputs
An interrupt subroutine in assembly and the corresponding pseudocode
push buttons
get requests
delete requests
.def temp =r16
.def output = r17
.def count = r18
.equ PATTERN = 0b01010101
in temp, SREG push temp
com output
out PORTC, output inc count
pop temp out SREG pop temp reti
Pattern=0b01010101
Count is an 8-bit integer initialised to 0
External_interrupt_0:
Push conflict registers to stack Flip(complement) pattern Write pattern to PORTC Increment count
Pop conflict registers
Return from interrupt
浙大学霸代写 加微信 cstutorcs
Specification: Microwave simulator
The microwave has four main modes:
• ‘entry’ – This is the default mode that the microwave starts in. In this mode, the cooking time can be entered, and menus can be accessed to configure the microwave.
• ‘running’ – In this mode, the microwave is active and cooking food.
• ‘paused’ – In this mode, the microwave is part-way through cooking food.
• ‘finished’ – This mode is entered after the cooking has been completed.
2. Time display
When in the ‘entry’, ‘running’ or ‘paused’ modes the cooking time should be displayed on the top-level corner of the LCD in the format ‘mm:ss’ with leading zeros. If no time has been entered yet, then no time should be displayed. eg: 1 minute 15 seconds should be displayed as ’01:15′.
3. Number keys
When in the ‘entry’ mode, the keypad number keys are used to enter a cooking time in the format ‘mm:ss’. The updated time should be displayed as more digits are entered. Only four digits should be accepted, and further key presses should be ignored.
4. Start button
The ‘*’ button on the keypad is used as the start button. When in the ‘entry’ mode, the start button will cause the microwave to start running for the amount of time that has been entered. If no time has been entered, the microwave will run for 1 minute.
When in ‘running’ mode, the start button will add 1 minute to the microwave’s current cooking time.
5. Stop button
The ‘#’ button on the keypad is used as the stop button. When in ‘entry’ mode the stop button will clear any current entered time.
In the ‘running’ mode, the stop button will pause operation.

6. Turntable rotation
The current position of the microwave turntable should be displayed in the top-right corner of the LCD at all times, using one of the ASCII characters ‘-‘, ‘/’, ‘|’ or ‘\’ to show the rotation.
While the microwave is running, the turntable should rotate at 3 revolutions per second.
7. Magnetron activity
When the magnetron is active, the electric motor should spin at approximately 70 revolutions per second.
8. Running mode
While in ‘running’ mode, the magnetron should be activated (in accordance with the power level) and the turntable should rotate. The time remaining should be displayed on the LCD as it counts down. When the time reaches zero the microwave should enter ‘finished’ mode.
9. Pause mode
When the stop button or open-door button is pressed while the microwave is running, the microwave time countdown will pause, and the turntable and the magnetron will be stopped. The ‘pause’ mode can be exit by pressing the start button to resume operation or pressing the stop button to cancel the operation and return to the ‘entry’ mode.
10. Finished mode
When the microwave finished cooking, the LCD should also display the text ‘Done’ on the first line and ‘Remove food’ on the second.
The microwave should stay in this mode until either the open-door button or the stop button is pressed. When they are pressed the microwave should return to ‘entry’ mode.
11. Open and close buttons
The left push-button is used as the open-door button, and the right push-button is used as the close door button. When the door is opened the microwave should pause immediately if running. While the door is open the microwave should not accept any input from the keypad. Pressing the open button while the microwave is open or the close button, while it is already closed, will do nothing. The microwave should be closed by default.

12. Open/closed display
The microwave should display the open/closed state in the bottom-right corner of the LCD at all times, using the letters ‘O’ or ‘C’ to represent open or closed.
The top-most LED should be lit when the door is open.
13. Power level selection
When in ‘entry’ mode, the ‘A’ key is used to select the power level. When pressed, the microwave should display the text ‘Set Power 1/2/3’ and wait until the ‘1’, ‘2’, ‘3’ or ‘#’ key is pressed. The ‘1’, ‘2’ and ‘3’ keys should select power levels 100%, 50% or 25% respectively. If the ‘#’ is pressed the microwave should return to ‘entry’ mode.
When running, the power level should determine what portion of each second the magnetron is active for. At 25%, the magnetron should be on for the first 250ms of each second and off for the rest. At 50% the magnetron should be on for the first 500ms of each second and off for the rest. At 100% the magnetron should be on constantly.
The current power level should be displayed on the lower 8 LEDs.
eg 50% power should be displayed with the bottom 4 LEDs on and the next 4 off.
14. Display Backlight
When in ‘entry’, ‘paused’ or ‘finished’ mode, the LCD backlight be turned off if no keys have been pressed for 10 seconds and turned back on when a key is pressed. When turning on or off the backlight should fade smoothly over 500ms. When in ‘running’ mode the backlight should be on permanently.
程序代写 CS代考 加微信: cstutorcs