Spacecraft - Ece
Personal tools

Spacecraft

From Ece

Jump to: navigation, search

Contents

Phase 1

Objective

The objective of this project is to successfully create a side-scrolling spacecraft game that is played on a VGA monitor and a analog joystick.

Team Members

  • Andrew Thigpen - Coordinator, Recorder
  • Josh Wilson - Checker, Recorder

Introduction

An analog joystick is a two axis ministick that has a potentiometer to control how much the spacecraft should move. The joystick is connected to a Analog-to-Digital converter. This converts into a signal in which the Basys board can use to update the monitor. A button will be used on the Basys board to shoot oncoming enemies on the monitor.

Concept

The project will be a game similar to that of Galaga, a popular arcade game in which the user controls a spacecraft and shoots enemies to stay alive. A joystick will be used to control the movements on the user’s spacecraft. The joystick is connected to an A/D converter that sends the data to the Basys board. The Basys board uses a button to allow the user to shoot. The Basys board sends all the information to a VGA monitor. When enemies are hit with projectiles from the user, they will disappear. Also, if the user’s spacecraft is hit by enemies, the user will be reset to the default location.

Proposed Work

Expected Deliverables

We expect to have created a simplified game of Galaga, which uses an analog joystick, Basys board, and VGA monitor.

Phase 2

Objective

The objective of this project is to successfully create a side-scrolling spacecraft game that is played on a VGA monitor and a analog joystick.

Team Members

  • Andrew Thigpen - Coordinator, Recorder
  • Josh Wilson - Checker, Recorder

Introduction

An analog joystick is a two axis ministick that has a potentiometer to control how much the spacecraft should move. The joystick is connected to a Analog-to-Digital converter. This converts into a signal in which the Basys board can use to update the monitor. A button will be used on the Basys board to shoot oncoming enemies on the monitor.

Concept

The project will be a game similar to that of Galaga, a popular arcade game in which the user controls a spacecraft and shoots enemies to stay alive. A joystick will be used to control the movements on the user’s spacecraft. The joystick is connected to an A/D converter that sends the data to the Basys board. The Basys board uses a button to allow the user to shoot. The Basys board sends all the information to a VGA monitor. When enemies are hit with projectiles from the user, they will disappear. Also, if the user’s spacecraft is hit by enemies, the user will be reset to the default location.

Proposed Work

Required Parts

Modules

  • a2dconverter
    • Description: Responsible for matching the timing of the signal from the A/D converter and routing the signal to the proper location.
    • Inputs:
      • a2d(7:0) - 8-bit value from A/D converter
    • Outputs:
      • joystickX(7:0) - x location of joystick
      • joystickY(7:0) - y location of joystick
    • Verification: Each output of this module will be connected to the LED lights of the Basys board, and the joystick will be moved in each direction to determine if the A/D converter is operating properly.
  • draw_vga
    • Description: Responsible for drawing all of the elements of the game on the screen.
    • Inputs:
      • clk - system clock
      • video_on - video only displays when this input is high
      • craftX(9:0) - x location of user's spacecraft
      • craftY(9:0) - y location of user's spacecraft
      • enemyX(9:0) - x location of enemy spacecraft
      • enemyY(9:0) - y location of enemy spacecraft
      • projectileX(9:0) - x location of projectile
      • projectileY(9:0) - y location of projectile
      • row(9:0) - row currently being drawn on the screen
      • col(9:0) - column currently being drawn on the screen
    • Outputs:
      • red - red output
      • green - green output
      • blue - blue output
    • Verification: The values of the inputs will be hard-coded to create a static image on the screen that displays each element at the same time.
  • vga_sync
    • Description: Responsible for maintaining the proper timings for displaying the VGA signal on the monitor.
    • Inputs:
      • clk - system clk
    • Outputs:
      • h_sync - horizontal sync
      • v_sync - vertical sync
      • video_on - high when drawing on the screen
      • pixel_row(9:0) - current pixel's row
      • pixel_col(9:0) - current pixel's column
    • Verification: This module is provided, and functionality does not need to be tested.
  • craft_control
    • Description: Responsible for keeping track of the user's craft position.
    • Inputs:
      • clk - system clock
      • joystickX(7:0) - x location of the joystick
      • joystickY(7:0) - y location of the joystick
      • enemyX(9:0) - x location of enemy on screen, used to determine if craft was hit
      • enemyY(9:0) - y location of enemy on screen, used to determine if craft was hit
    • Outputs:
      • craftX(9:0) - x location of craft on screen
      • craftY(9:0) - y location of craft on screen
    • Verification: The input values will be hard-coded to display the user's spacecraft moving on the screen and being hit by an enemy.
  • enemy_control
    • Description: Responsible for keeping track of the enemy's position.
    • Inputs:
      • clk - system clock
      • projectileX(9:0) - x location of projectile on screen, used to determine if enemy was hit
      • projectileY(9:0) - y location of projectile on screen, used to determine if enemy was hit
    • Outputs:
      • enemyX(9:0) - x location of enemy on screen
      • enemyY(9:0) - y location of enemy on screen
    • Verification: The input values will be hard-coded to display the enemy moving on the screen and being hit by a projectile.
  • projectile_control
    • Description: Responsible for keeping track of the projectile's position.
    • Inputs:
      • clk - system clock
      • enemyX(9:0) - x location of enemy on screen, used to determine if enemy was hit
      • enemyY(9:0) - y location of enemy on screen, used to determine if enemy was hit
    • Outputs:
      • projectileX(9:0) - x location of projectile on screen
      • projectileY(9:0) - y location of projectile on screen
    • Verification: The input values will be hard-coded to display the projectile moving on the screen and hitting an enemy.

Expected Deliverables

We expect to have created a simplified game of Galaga, which uses an analog joystick, Basys board, and VGA monitor.

Modifications

Instead of the Maxim517, which is a Digital-to-Analog Converter, we will be using the Maxim1117, an Analog-to-Digital Converter.

Phase 3

Modules

  • a2dconverter

This module takes an 8-bit value from the analog-to-digital converter and outputs the current location of the spacecraft.

    • Inputs:
      • a2d(7:0) - 8-bit value from A/D converter
    • Outputs:
      • joystickX(7:0) - x location of joystick
      • joystickY(7:0) - y location of joystick
    • Verification: Each output of this module will be connected to the LED lights of the Basys board, and the joystick will be moved in each direction to determine if the A/D converter is operating properly.
  • draw_vga

This module draws the spacecrafts and the projectiles onto the VGA monitor.

    • Inputs:
      • clk - system clock
      • video_on - video only displays when this input is high
      • craftX(9:0) - x location of user's spacecraft
      • craftY(9:0) - y location of user's spacecraft
      • enemyX(9:0) - x location of enemy spacecraft
      • enemyY(9:0) - y location of enemy spacecraft
      • projectileX(9:0) - x location of projectile
      • projectileY(9:0) - y location of projectile
      • row(9:0) - row currently being drawn on the screen
      • col(9:0) - column currently being drawn on the screen
    • Outputs:
      • red - red output
      • green - green output
      • blue - blue output
    • Verification: The values of the inputs will be hard-coded to create a static image on the screen that displays each element at the same time.
  • vga_sync

This module maintains the proper timings for displaying the VGA signal on the monitor.

    • Inputs:
      • clk - system clk
    • Outputs:
      • h_sync - horizontal sync
      • v_sync - vertical sync
      • video_on - high when drawing on the screen
      • pixel_row(9:0) - current pixel's row
      • pixel_col(9:0) - current pixel's column
    • Verification: This module is provided, and functionality does not need to be tested.
  • craft_control

This module controls where the crafts are located and also if two crafts meet.

    • Inputs:
      • clk - system clock
      • joystickX(7:0) - x location of the joystick
      • joystickY(7:0) - y location of the joystick
      • enemyX(9:0) - x location of enemy on screen, used to determine if craft was hit
      • enemyY(9:0) - y location of enemy on screen, used to determine if craft was hit
    • Outputs:
      • craftX(9:0) - x location of craft on screen
      • craftY(9:0) - y location of craft on screen
    • Verification: The input values will be hard-coded to display the user's spacecraft moving on the screen and being hit by an enemy.
  • projectile_control

This module controls the projectiles of the enemies

    • Inputs:
      • clk - system clock
      • enemyX(9:0) - x location of enemy on screen, used to determine if enemy was hit
      • enemyY(9:0) - y location of enemy on screen, used to determine if enemy was hit
    • Outputs:
      • projectileX(9:0) - x location of projectile on screen
      • projectileY(9:0) - y location of projectile on screen
    • Verification: The input values will be hard-coded to display the projectile moving on the screen and hitting an enemy.

Phase 4

Top-level Schematic

Image:spacecraft_schematic.jpg

Deliverables

Source Code: http://www.ece.msstate.edu/~att22/project.zip

Project Changes

Instead of a two channel ADC, a one channel ADC was used which means that the spacecraft can only move in one direction (on the y-axis) and not two as originally planned. Collision detection was moved from the craft_control module to the enemy_control module for convenience and the enemyX and enemyY inputs of the craft_control module were replaced with a single wire, userhit. Additionally, the projectile_control module was merged with the enemy_control module for convenience.