PROG1360 ASSIGNMENT 4 – BLINKING LIGHTS AND SENSORS

$30.00

Category: Tags: , , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (2 votes)

OBJECTIVES
• Structure your assembly code
• Blink some lights
• Interface with the sensors
MAJOR TASKS
DEMONSTRATION – BUILDINGON LABS
This assignment builds on thelabs and assignmentsso 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).
DOCUMENT REQUIREMENTS
This assignment requires a single flowchart of the flow of your code. This flowchart should use standard flowchart shapes for steps and decisions, and should correspond with your logic.
Please print the table below, with your name clearly displayed, for marking purposes.
Item Grade
Demonstration
/ 5
Code
Functionality / 5
Proper use of registers, etc. / 5
Readability / 5
Comments / 5
Code Subtotal
/ 20
Total
/ 25
Applicable Cap:
CAPS
If you do not complete all functionality, the following caps will be applied:
Function Maximum Grade
Hard coded delays 60%
Win / Loss missing 80%
Game works but is unplayable 90%
All functions implemented 100%
SUBMISSION GUIDELINES
PLEASE READ AND UNDERSTAND THE SUBMISSION GUIDELINES BELOW. FAILURE TO CORRECTLY SUBMIT ANY REQUIRED COMPONENT WILL RESULT IN 20% PENALTY PER MISSING OR INCORRECT COMPONENT.
PAPER SUBMISSION
Please print your flowchart and include the grade table. Ensure your name is on all pages.
ELECTRONIC SUBMISSION
Exactly THREE items will be submitted electronically.
• A PDF of your flowchart
• Upload the complete C hook file xx_hook.c.
• Upload your complete assembly file (the xx_asm.s file).
FOR THIS ASSIGNMENT, PLEASE DO NOT COMPRESS EITHER FILE, AND PLEASE BE CERTAIN YOU HAVE NAMED IT AND YOUR FUNCTIONS CORRECTLY.
Complete file naming and upload guidelines are provided below.
ELECTRONIC SUBMISSION AND FILE NAMING
Often, multiple groups will name their assignment files assignment1.zip (or some other common combination) which results in confusion and complications when downloading and unzipping submitted electronic files.
Please follow the following guidelines for all submissions this term. Failure to follow the electronic submission guidelines may result in a 10% penalty per infraction.
As long as other file naming conventions are followed, you may choose to append an assignment identifier (i.e. “_a1” or something else as appropriate) as the LAST element before the file extension.
DOCUMENT NAMING AND SUBMISSION
Unless otherwise requested, you should only ever submit a single document containing the complete document as specified. This document must be:
• A professionally formatted document adhering to the SET report standard
• A single PDF file, NOT included in a zip
UNLESS INDICATED OTHERWISE, DO NOT SUBMIT THE ASSIGNMENT SPECIFICATION AS A PART OF YOUR DOCUMENT.
Documents should be named with the usernames of all team members as follows:
• Individual assignments: username.pdf (i.e. jsmith.pdf)
• When working alone: username_alone.pdf (i.e. jsmith_alone.pdf)
• When working with a partner: username1_username2.pdf (i.e. jsmith_bjones.pdf)
• When working as a team: username_team.pdf (i.e. jsmith_team.pdf – but be certain to include all team members on report title page)