SWEN-340

SWEN-340 UART LED Project

Overview

Using code provided for FirstTimer Homework assignemt, including the provided LED.c, create a command line UI that controls the red and green LEDs via the virtual UART port

UI Requirements

    Implement all of your code in additional function(s) in additional C source file(s)

    The main.c function must NOT have any application code except calls to initialization functions. After the initialization it should only call your control function which is in a different source file.

    Use good modular development practices when creating your C language source files. Avoid function of over 20 lines unless the reason for more that 20 lines is a switch statement.

  • Requirements are documented here -> Project Requirements
  • Important Notes:

  • All commands are case sensitive.
  • All commands are processed when the Enter key is pressed.
  • Display "Invalid command" message if not a valid command.
  • An incorrect key entry can be corrected by pressing the Backspace key. This will remove the most recent key and redisplay the remaining command on the same line.
Software Design Topics

    Here are some suggestions on how to design your application control loop (Do not put this in main.c):

  • In your application control loop you need an infinite loop (the main loop)
  • Be sure to use the USART_Read_Nonblocking function
  • Refer to the example code LED Example Code
  • Call USART_Read_Nonblocking. If it returns a character (non-zero) process that character.
  • Your main loop must not have any delay steps. Timing is done by using the SysTick handler timing. Use a static counter to 1000 in the Systick handler. Set a global one second elapsed flag when the handler has been called 1000 times.
  • When 1.0 seconds has elapsed (check the global one second elapsed flag) change the state of any flashing LEDs to the opposite state.
Pseudo Code
Pictures, References and Setup

Nucleo Reference Manual

LED Example Code

LED Schematic

Circuit - Top View

Circuit - Side View

Circuit - shield-gap

Connect the red LED to Arduino pin D11 (Nucleo PA7) and the green LED to Arduino pin D12 (Nucleo PA6).

Use a 2K or 5K resistor in series with the LED to limit the current flowing through the LED

Submission

Submit your UART LED Src and Inc directories in a Src.zip and a Inc.zip archives to the UART LED project Part 1 myCourses Assignment folder

Include a statement in your submission indicating which tests in the demo sheet pass when done in the specified order.

Be sure that your software works correctly by precisely following the steps in Demo Sheet. You must do the whole set of tests in order.

Be sure to address all warnings!

Grading

100 possible points as described in the Grading Sheet

Grading sheet

All projects must be submitted on-time. 5% panelty will be applied for any late submissions