top of page

AVR Programming Project Using C | C Programming Help | Codersarts


As part of the assessment for this course, you are required to undertake a project which will test you against some of the more practical learning objectives of the course. The project will enable you to demonstrate your understanding of

  • C programming

  • C programming for the AVR

  • The Atmel Studio environment.

You are required to modify a program in order to implement additional features. The program is a simple version of the game Space Impact. The AVR ATmega324A microcontroller runs the program and receives input from a number of sources and outputs a display to a LED matrix display board, with additional information being output to a serial terminal and, to be implemented as part of this project, a seven-segment display and other LEDs.

The version of Space Impact provided to you will implement basic functionality – the background scrolls left to right and aliens appear and move but the player can only move in one direction (up) and the game ends immediately when the player dies once. You can add features such as scoring, moving in other directions, multiple lives, sound effects, etc. The different features have different levels of difficulty and will be worth different numbers of marks.

Don’t Panic!

You have been provided with over 2700 lines of code to start with. Whilst this code may seem confusing, you don’t need to understand all of it. The code provided does a lot of the hard work for you, e.g., interacting with the serial port and the LED display. To start with, you should read the header (.h) files provided along with project.c, player.c, projectile.c and alien.c. You may need to look at the AVR C Library documentation to understand some of the functions used. A video will be provided to introduce the project.

Grading Note

As described in the course profile, if you do not score at least 15% on this project (before any late penalty) then your course grade will be capped at a 3 (i.e. you will fail the course). If you do not obtain at least 50% on this project (before any late penalty), then your course grade will be capped at a 5. Your project mark (after any late penalty) will count 20% towards your final course grade.

Resubmissions prior to grade finalization are possible to meet the 15% requirement in order to pass the course, but a late penalty will be applied to the mark for final grade calculation purposes.

Program Description

The program you will be provided with has several C files which contain groups of related functions.

The files provided are described below. The corresponding .h files (except for project.c) list the functions that are intended to be accessible from other files. You may modify any of the provided files. You may add additional files if desired. You must submit ALL files used to build your project, even if you have not modified some provided files. Many files make assumptions about which AVR ports are used to connect to various IO devices. You should not change these.

  • project.c – this is the main file that contains the event loop and examples of how time-based events are implemented. You should read and understand this file.

  • game_position.h/game_position.c – contains an explanation of how positions are represented in the game, some useful macro definitions, and some functions to calculate neighbouring positions.

  • player.h/player.c – contains code related to the player in the game (e.g. player movement and display). You should read these files and understand the representation used for the player. You will need to modify this file to add required functionality.

  • alien.h/alien.c – contains code related to the aliens. You should read at least the header file (alien.h) and you may need to read/modify the .c file for some of the more advanced functionality.

  • projectile.h/projectile.c – contains code related to the projectiles fired by the player. You should read at least the header file (projectile.h) and you may need to read/modify the .c file for some of the more advanced functionality.

  • game_background.h/game_background.c – contains code related to the scrolling game background. You should read at least the header file (game_background.h) and you may need to read/modify the .c file for some of the more advanced functionality.

  • buttons.h/buttons.c – contains the code which deals with the IO board push buttons. It sets up pin change interrupts on those pins and records rising edges (buttons being pushed).

  • ledmatrix.h/ledmatrix.c – contains functions which give easier access to the services provided by the LED matrix. It makes use of the SPI routines implemented in spi.c

  • pixel_colour.h – contains definitions of some useful LED matrix colours

  • score.h/score.c – contains code for keeping track of and adding to the score. This module is not used in the provided code.

  • scrolling_char_display.h/scrolling_char_display.c – contains code which provides a scrolling message display on the LED matrix board.

  • timer0.h/timer0.c – contains code that sets up a timer that is used to generate an interrupt every millisecond and keep track of a global time value.

  • serialio.h/serialio.c – contains code that is responsible for handling serial input and output using interrupts. It also maps the C standard IO routines (e.g. printf() and fgetc()) to use the serial interface so you are able to use printf() etc for debugging purposes if you wish. You should not need to look in this file, but you may be interested in how it works and the buffer sizes used for input and output (and what happens when the buffers fill up).

  • spi.h/spi.c – contains code that encapsulates all SPI communication. Note that by default, all SPI communication uses busy waiting – the “send” routine returns only when the data is sent. If you need the CPU cycles for other activities, you may wish to consider converting this to interrupt-based IO, similar to the way that serial IO is handled.

  • terminalio.h/terminalio.c – this encapsulates the sending of various escape sequences that enable some control over the terminal appearance and text placement – you can call these functions (declared in terminalio.h) instead of remembering various escape sequences. Additional information about terminal IO will be provided on the course Blackboard site.

  • line_drawing_characters.h – contains definitions of some Unicode line-drawing characters that may be useful for terminal output. The definitions are not used in the supplied code.

Contact us for this machine learning assignment Solutions by Codersarts Specialist who can help you mentor and guide for such machine learning assignments.

If you have project or assignment files, You can send at directly

bottom of page