Starting from:

$25

PROG1360-Assignment 4 Blinking Lights and Sensors Solved

Objectives
·        Structure your assembly code

·        Blink some lights

·        Interface with the sensors

Major Tasks
Demonstration – Building on Labs
This assignment builds on the labs and assignments so far.

The Demonstration section of this document outlines the items you are required to show.

Tasks
You will implement a new simple game that uses the lights and accelerometer on the board.

Given the command below (where xx is your initials)

xxTilt delay target game_time
your board will turn on the light(s) according to the X and Y accelerometer values retrieved via the I2C interface. See the appropriate lab for details of retrieving these values.

When the target light has been kept on for the target time, you win, and the board flashes all lights twice (as you did in the last assignment).

If you do not manage to turn on the lights in the allotted game time (specified in seconds) you lose, and the single target light will be turned on.

Example:

jsGame 500 5 30
This would run the game with a target of light 5 being on for 500ms to win. The game will run for 30 seconds in this case before it would end with a loss

Note that you will have to find a way to time your game – in this case, busy_delay is not going to be useful for you.

Requirements
·        No logic is to be implemented in your C hook code unless it is related to eliminating the busy delay.

·        You may use library functions from the stm32 code to parse input.

·        You will have to use the I2C functions to retrieve accelerometer values.

·        It is very important that you structure your code cleanly for this assignment.

·        You must name all functions and adapt any menu help instructions appropriately.

·        You will have to determine how to count time (approximation is OK).

·        On starting the game, ensure that all lights are first turned off.

Demonstration
Please note that you must be prepared before offering to demonstrate your code. You must demonstrate the code that you have submitted to the eConestoga dropbox.

For this assignment, you will demonstrate the following items. You may use a lab PC or your own. If needed, you may use a classmate’s VM, but you MUST run your own code and only your own code. You must demonstrate in your regularly scheduled lab period. If you demonstrate modified code, you will receive a late penalty according to how long it has been since the dropbox deadline.

1.      Your xx_hook.c and xx_asm.s code as taken directly from the drop box compiles.

2.      Your code deploys with sudo make program.

3.      Your code runs with no parameters provided (sensible defaults).

4.      Your code runs as specified.

5.      You can demonstrate both cases – that it is possible to both win and lose.

Code
Your code will be evaluated as follows. Each will be evaluated on a 0 to 5 basis, where 0 is unacceptable or not present, and 5 is excellent.

Functionality
Your program behaves as specified.

Proper use of Registers, the stack, and link register
Only necessary items (no more, no less) are pushed onto the stack. Your function calls use the link register appropriately.

Code Readability and Structure
Your code is properly indented, does not wrap or have long lines, and can be logically understood.

You use subroutines and memory appropriately.

Code comments
As this is assembly language, you must extensively comment any code that is unclear (i.e. nearly every line).

More products