Project Preliminaries AlteraBot Introduction Prelab Exercises Lab

Document Sample
Project Preliminaries AlteraBot Introduction Prelab Exercises Lab Powered By Docstoc
					             Project Preliminaries: AlteraBot Introduction
Prelab Exercises
1. Review the lecture slides.

2. Read section 6.5 of Hamblen, Hall and Furman to understand how a seven-segment display
   can be used to display hexadecimal digits.

3. Read section 12.2 also, since it provides some background into how the UP2 board is
   communicating with the robot using RS-232 protocol.

4. Read the AlteraBot Datasheet, available as a separate download. Make sure that you
   understand the register model of the robot and the operation of the pins as needed to read and
   write values.

5. Write a simple computer program that does exactly what is described as the application
   example of the datasheet. You may use the programming example available at the web site
   as a starting point. The primary difference is that the given example does not execute a turn.
   This is what the TAs will want to see as your prelab checkoff.

6. Familiarize yourself with the amigoscomp project file provided on the web site, especially
   the top-level design file amigoscomp.bdf, and the new version of scomp.vhd. You should be
   able to recognize what the functions are of the various devices appearing at the top level (but
   not necessarily inside those devices, at least not at this time, and not for the prelab quiz).

Lab Exercises
The prelab steps and the remaining lab steps are designed to prepare you for writing real
programs on the UP2 board with the AmigoBot robot. Pay close attention to what you are doing,
and you will find it much easier to a) propose something reasonable, and b) implement what you

1. Check out an AlteraBot robot and an AmigoBot power supply (only one robot per project
   team). Make sure that the robot is turned off (underneath robot, near caster) and that it is
   plugged into the power supply, which should be labeled “AmigoBot” (the power supply for
   the KVM switch is very similar, and should be plugged into the KVM switch itself, but
   things sometimes get moved).

2. (OPTIONAL) If you have any concerns or questions about using Quartus II on the UP2,
   consider doing “Tutorial 1” in Chapter 1 of Hamblen, Hall and Furman, always choosing the
   appropriate steps for the UP2, rather than the UP3. You may find it simple and
   straightforward to do all the following steps without any special UP2 tutorial, though. When
   you use the UP2 board, you must turn on the robot, since it supplies power to the board.

3. Download all of the project files from the web site to your working directory on the hard
   disk, and copy your prelab ASM code to the directory as well.

4. Disconnect the computer’s 25-pin programming cable from the UP3 board’s ByteBlaster, if
   necessary, and connect it instead to the UP2 board on the robot, using the internal
   ByteBlaster that is part of the robot. Connect the VGA cable to the UP2 board as you would
   have done in previous UP3 labs that involved VGA output. Start Quartus II.

5. Exercise 1: Displaying internal robot registers
   The robot should never move on its own during this exercise.
   A. For this exercise, a precompiled file will be downloaded, enabling you to view the
      internal registers described in the AlteraBot datasheet. You should be familiar with the
      datasheet from the prelab exercise. Select the “Programmer” tool from the Quartus II
      “Tools” menu, then set it up to program/configure the downloaded file from the web site
      called “amigotest.sof.”
   B. Turn on the robot. The red LED should illuminate, and the green LED should blink
      slowly. Do not rotate or move the robot until later instructions tell you to do so, since it
      will alter the internal position estimate.
   C. Select “Start” in the Programmer window to initiate programming/configuration of the
      FLEX chip on the UP2 board. Once the programming is complete, the robot should say
      “Connected,” and the green and red LEDs on the robot should blink quickly. The least-
      significant decimal point on the UP2 board 7-segment display should also be blinking
      quickly. (The yellow LED indicates that the robot is sending data packets each time it
      blinks, and the decimal point indicates that the UP2 board is successfully interpreting
      each data packet. Note: The robot will soon start saying “Uh-oh, we’re losing
      communication.” This is because the test application is not sending any commands, so
      the robot is unsure about whether anyone is listening. Just ignore this for now.
   D. One pushbutton on the UP2 board will reset the board, and another triggers a primitive
      means of sending commands to the robot. Don’t press either button, because a reset
      would make you start over, and a command could make the robot start moving, possibly
      running off the table and costing you a lot of money.
   E. Set up the KVM switch to make the VGA display show the output from the UP2 board.
      You should see 16 registers, labeled 0-F. These correspond exactly to the 16 output
      registers described in the datasheet (the ones that can be read, not written).
   F. Confirm that the X, Y, and theta positions are all near zero. X and Y can go negative, so
      don’t forget that small negative numbers look like FFFF, FFFE, and so on. Theta is
      always positive, but flips over from 0FFF to 0000 (corresponding to the fact that any
      angle over 360 degrees is simply reduced by 360 degrees, as you would expect).
   G. In unaltered hexadecimal, record X, Y, and theta, as well as the battery voltage. Record
      only the battery voltage digits, ignoring the other status information in that word.
   H. Convert the positions and angles to millimeters and degrees, and record them. Convert
      the battery reading to volts, using the datasheet information, and record it, too. If the
      robot voltage is less than 11.0 V, let the robot recharge before continuing, or check out
      another robot. If the robot voltage is more than 13.0 V, you are probably converting
   I. Without lifting the robot, move the robot forward approximately one robot length, so that
      the rear of the robot ends up about where the front of the robot started. Record the values
   J. Without lifting the robot, rotate the robot approximately 90 degrees clockwise, trying to
      keep the robot center at the same spot. Record the values again.
   K. Move the robot forward and backward while watching the display. Does X or Y change
      the most now? How does this compare with before you rotated the robot?
   L. Pick a sonar sensor that you can point in a direction that can be kept fairly clear of
      obstructions for at least 2 meters. Find that sensor on the VGA display. Record the
      largest value you can observe while keeping the area clear, and then move a book or
      other obstruction closer until it reaches the lowest reading possible. Record that value,
      and also estimate at what distance that first occurs. Convert all the sonar readings to
   M. Power down the robot and disconnect the VGA cable.

6. Exercise 2: Example simple computer program
   This involves making the robot move. You will NOT have the VGA display available as
   a debug tool.

   A. Close all files in Quartus II. Open the project amigoscomp.qpf.
   B. Make sure that your simple computer program from the prelab waits for PB2 to be
      pressed before sending any commands to the robot. If necessary, add those instructions
      at this time (see the amigoexample.asm file provided with the other simple computer
   C. Assemble your program file in your working directory. If your mif file is not named
      amigoexample.mif, either rename it or change the appropriate lines in scomp.vhd to
      “point” to whatever name you used for your mif file.
   D. Compile the project. This may take a while.
   E. The order of the following steps is crucial. If you do something out of order, power off
      and start over. 1) Power up the robot. 2) Program/configure amigoscomp.sof. 3) After
      the robot says “Connected,” disconnect the charger and the ByteBlaster. 4) Place the
      robot in a clear area, and press PB2 to start your program. Be prepared to grab the robot
      if it goes further than 0.5 meters before stopping! Turn it off or press the red reset button
      to stop the motors.
   F. When your program is debugged, demonstrate it for the LTA.
                Lab 9 (Project – Week 1) Check-off sheet
Lab Section: _________        LTA’s Name: _____________________________

Student’s Name (print): ______________________________

1. Prelab completed (simple computer program written)     _______________

2. Values recorded from VGA screen after initial download of amigotest.sof (raw hexadecimal):
             X          __________________
              Y            __________________
              Theta        __________________
              Battery      __________________
              TA:__________         Date/Time:___________

3. Converted readings (decimal, with scaling):
             X          __________________ mm
              Y            __________________ mm
              Theta        __________________ deg
              Battery      __________________ volts
              TA:__________         Date/Time:___________

4. Values after moving robot one robot length:
              X      _________ raw _________ mm
              Y         _________ raw     _________ mm
              Theta _________ raw         _________ deg
              TA:__________         Date/Time:___________

5. Values after rotating robot approximately 90 degrees clockwise:
              X        _________ raw _________ mm
              Y         _________ raw     _________ mm
              Theta _________ raw         _________ deg
              TA:__________         Date/Time:___________

6. Sonar readings:
              Largest      _________raw      _________ mm
              Smallest     _________raw      _________ mm
              TA:__________         Date/Time:___________

7. Demonstration of example program

              TA:__________         Date/Time:___________