⚙️

Microcontroller Programming Exam Guide

Nov 8, 2024

Unit 6 Microcontrollers Exam Tutorial

Overview

  • Focus on Activity 4: Programming
  • Develop a user-friendly system:
    • Well-organized, structured, and formatted code
    • Annotating the code
    • Assembly and integration of any required hardware
    • Ensuring system functionality and handling unexpected events
  • Submission includes:
    • Electronic task booklet
    • Video from Activity 6

Activity 4: Key Steps

Code Development

  1. Program Setup
    • Begin by initiating the LCD screen and buttons.
    • Use a while 1 loop for continuous running of the program.
    • Clear the screen to ensure clarity.
    • Set initial variables and states (e.g., fare starting at £1.50).
  2. Program Execution
    • Button Press Mechanism:
      • Program waits for button press (e.g., button zero to start journey).
      • Implement repeated checks to ensure responsive button inputs (checking 10 times per second).
    • Time and Fare Calculation
      • Add 0.1 seconds to timer per loop; add 20p to fare every 20 seconds.
      • Use simple arithmetic operations to calculate and display fare.
  3. Loop Control and Fare Adjustments
    • Introduce surcharges or discounts based on additional button presses.
    • Allow buttons to add or subtract 50p to/from the fare.

Code Annotation

  • Importance of annotating code for examiner understanding.
  • Steps to annotate:
    • Use screenshot tools (e.g., Snipping Tool) to capture sections of code.
    • Insert screenshots in PowerPoint or similar tools to add annotations.
    • Explain each function and section, e.g., initialization and variable setups.

Final Documentation

  • Insert annotated code sections into the electronic task booklet.
  • Include:
    • Screenshots of code with annotations
    • Descriptions of hardware setup
    • Discussion of how code handles unexpected events

Tips for High Marks

  • Break the code into logical sections for easier annotation and explanation.
  • Provide detailed explanations to demonstrate understanding.
  • Consider potential unexpected events and how your code addresses them.
  • Include illustrations and annotations of hardware and simulated circuits.

Conclusion

  • Annotations are crucial for high marks; code alone is not enough.
  • Aim for comprehensive documentation to maximize scores.
  • Good luck with your exams!