Assignment title: Information


Background This assignment requires the completion of an embedded systems coding project to a design specification and comprises four elements as follows: • Logbook: Exercises provided in the laboratory handbook for this module are to be completed and evidenced in an electronic logbook. • Developed project code: You must develop and code an embedded systems solution which satisfies the stated specification. • Short written report: A short report (1500 words) summarising the design rationale for your submitted project code. • Demonstration: A short demonstration where the performance of your embedded systems solution is assessed against the specification and you will be asked question about the code you submitted. Submission requirements • Logbook: To be submitted electronically to Turnitin via Unilearn by midnight on the specified deadline. • Developed project code: To be submitted electronically to Unilearn by midnight on the specified deadline. The whole project directory must be submitted as a .zip file and must build with no errors. • Short written report: To be submitted electronically to Turnitin via Unilearn by midnight on the specified deadline. • Demonstration: You will attend a demonstration in the embedded systems laboratory which will be scheduled in your normal allocated laboratory session in the final week of the Spring term. The demonstration will last approximately 5-10 minutes.   Learning outcomes to be assessed Knowledge and understanding: b. Interpret manufacturers' data sheets to explain and compare the internal architectures of microcontrollers and their associated interfacing design strategies. Abilities: c. Develop software solutions to microcomputer- and microcontroller-based system design problems through the use of appropriate design methods and development tools. d. Develop hardware solutions to microcomputer- or microcontroller-based system design problems. e. Evaluate the performance of microcomputer and microcontroller-based system designs and compare alternative solutions. Assessment criteria Logbook • Standard and completeness of set laboratory practicals • Organisation and structure of logbook including the context and discussions provided Developed project code • Design of the code • Structure of the code • Efficiency of developed functions • Code layout and annotation Short written report • Quality of introduction and conclusion sections • Description of design approach • Effectiveness of diagrams • Structure and organisation of the report Demonstration (25 marks) • Functionality of code with respect to the specification • Ability to answer technical questions on all aspects of the developed code Feedback Formative feedback on the development of the logbook and the project code will be available during scheduled laboratory sessions on a one-to-one basis. Summative feedback for this assignment will be provided through a written feedback sheet comprising a partial mark breakdown and criteria specific commentary.   Design Specification – Digital Alarm Clock and Weather Station Background Alarms clocks are an essential item for modern living, helping to aid punctual arrival for all manner of essential activities such as work and attendance to lectures. The basic functionality of an alarm clock comprises the ability to display the current time and create an audible alert at a user-specified time. Many alarm clocks are augmented with further functionality such as the ability to pick up radio broadcasts, monitor the weather, and even make tea. In this project you will be using the Matrix Multimedia PIC development platform to design an embedded system comprising an alarm clock with a weather monitoring function. Alarm clock weather stations have a remote sensor unit that is placed outside in order to measure meteorological characteristics should as temperature and relative humidity. In this way the user is usefully informed as to the manner in which they should attire themselves prior to leaving the home. An example of a typical alarm clock weather station device type is shown in figure 1. Figure 1 Phillips AJ260 Digital alarm clock and weather station Aim To develop a C program to simulate the embedded system contained in an alarm clock weather station and to evaluate its operation using the Matrix Multimedia E-Block PIC development system. The inputs to the system are simulated by pushbutton switches and the built-in transducers. The LCD is used to display menu options and show essential information including current time, alarm time, outside temperature, and relative humidity. LEDs are used to simulate outputs such the alarm buzzer.   Part 1: Hardware specification The diagram below summarises the inputs and outputs to the PIC16F877A which will be used to simulate the development of the digital alarm clock weather station. Part 2: Operational specification Overview The system operates in 3 basic modes: Mode Purpose Running mode Device is free-running and displays time and weather information Configuration mode Device is displaying a menu system to allow the configuration e.g. setting time and alarm time. Alarm mode Entered only when the current time matches the set alarm time and the alarm is enabled. Running Mode Download your completed project .hex file onto the PIC. The following screens should appear on the LCD, starting with screen 1. The screens should cycle through repeatedly, with a 5 second interval between each screen. In this way user information on the current alarm time, relative humidity and temperature are communicated to the user, while the time is displayed permanently. In the above representations of the LCD screen, the following formats must be adhered to: • Time is in the format hours:minutes:seconds • Alarm time is in the format hours:minutes • Relative humidity (RH) displayed as a percentage to a precision of one decimal place • Temperature is displayed to a precision of one decimal place. The unit displayed is deg C or deg F depending whether the temperature mode is set to Centigrade or Fahrenheit respectively. Display of current time (all screens) The current time should be updated on the display at one second intervals. Timer1 should be used to accurately generate the time interval required to do this. The time should update continuously and smoothly throughout all screen changes. Display of alarm time (screen 1) The alarm time as currently set should be displayed in the format described above. Display of current temperature (screen 2) The output of the temperature module in the remote sensor unit is simulated by the analogue input connected to RA1. The voltage applied to RA0 can be set between approximately 0-5 volts via the potentiometer on the E-block sensor board. When the temperature mode is set to Centigrade, the temperature displayed in running mode should range from -40 to +50 °C and map linearly with the position of the potentiometer. When the temperature mode is set to Fahrenheit, the following scale conversion should first be applied before displaying the data: Accordingly, in the Fahrenheit mode, full scale temperature range will be -40 to 122 °F. Display of current relative humidity (screen 3) The output of the humidity module in the remote sensor unit is simulated by the analogue input connected to RA0. The voltage applied to RA0 can be varied between approximately 0-5 volts light dependant resistor (LDR) on the E-block sensor board. The relative humidity value displayed during running mode should vary between approximately 10% and 90% RH. Enabling/disabling the alarm At any time during operation, the alarm may be enabled/disabled by pressing the RB7 (Alarm Toggle) pushbutton. When the alarm is enabled the LED connected to RD6 (Alarm Enable Status) must be ON. If the alarm is disabled then the alarm mode will not be entered. Configuration Mode A menu system must be provided in order to allow the user to configure the system. If the button attached to RD2 (Select) is pressed during running mode the system should enter the configuration mode. At this point scrollable two-line menu screen is presented to the user. Using a combination of RD0 (Cursor Up), RD1 (Cursor Down) and RD2 (Select) pushbutton switches, the user may select the configuration item. The correct sequence of menu screens and cursor movement is shown below, for both up and down cursor directions. The menu system should not wrap-around. The configuration menu can be exited at any time by pressing the RD3 (back) pushbutton, at which point the system reverts to running mode. Setting the time User selects the Set Time menu and then sets the cooking time using a combination the following pushbutton switches: RD0 (increase current digit), RD1 (decrease current digit) and RD2 (move to next digit). The LCD cursor function should be used to make clear which digit is currently being entered. The figure below shows an example sequence for the numeric entry. At any point in the sequence, the back button (RD3) can be pressed. This must move the cursor to the previous digit so that any errors may be corrected. Setting the alarm time User selects the Set Alarm menu item and then proceeds to precisely the same sequence of events as the Set Time procedure. See below for an example sequence. Setting the Temperature Mode User selects the Temp Mode menu item and is presented by a simple two-line menu. Using a combination of RD0 (Cursor Up), RD1 (Cursor Down) pushbutton switches the cursor can be moved to select the preferred temperature unit. When the RD2 (Select) pushbutton is pressed, the temperature mode is updated and the system returns to running mode. Pressing the RD3 (back) pushbutton will return to the high-level configuration menu without changing the temperature mode. Alarm Mode Alarm mode is only entered when two conditions are true: • Current time matches the set alarm time • Alarm Enable mode is ON In fully engineering system, the alarm would typically be a piezoelectric buzzer connected to a digital output. For out purposes, this will be simulated by driving the LED connected to RD7 (Alarm buzzer). When alarm mode is entered the LED connected to RD7 (Alarm buzzer) must be toggled with the following sequence which must be repeated 20 times: • RD7 ON for 0.25 s • RD7 OFF for 0.5 s During the alarm buzzing sequence running mode must continue to operate i.e. the screens should carry on advancing and current time should continue to advance. In order to achieve this, the alarm mode actions must be interrupt driven. While alarm mode is active, it should be possible to perform a snooze function, by pressing the pushbutton connected to RD4 (Snooze). In this case the alarm goes off i.e. the LED connected to RD7 (Alarm buzzer) goes OFF for 5 seconds. After the elapsed time the alarm mode is re-started and the alarm sequence started above is repeated.   Part 3: Further requirements Default Settings Upon system startup i.e. on power-up or reset, the following default settings should be used so that a known state is entered into. Item Default value at startup Time 00:00:00 Alarm Time 08:00 Temperature Mode Centigrade Alarm Enable Status Off Use of interrupts There are a number of specific requirements for the implementation of delays. Marks will be awarded for implementing the following features using interrupts: Incrementing the current time Accurate time keeping is the most important performance parameter for a clock. Time keeping routines associated with incrementing the current time should be implemented using the hardware timer module, TMR1 and its associated overflow interrupt (TMR1E/TMR1F) via an interrupt service routine. Alarm Enable Toggle RD7 (Alarm toggle) should enable/disable the alarm at any point during the operation. In order to achieve this simply it should be implemented using the PORTB interrupt on change (RBIE/RBIF) which generates an interrupt for any state change on PORTB4:7. Using a suitable interrupt service routine will allow the button press to be detected and recorded at any point in the operation. Alarm mode sequence TMR0 should be used to set the intervals at which the RD7 (Alarm buzzer) is toggled. This toggling should be carried out using the TMR0 overflow interrupt (TMR0IE/TMR0IF) via an interrupt service routine. By driving the toggling of RD7 using interrupts it is possible to enable the alarm to go off while running mode remains fully operational.