08 Jan 2009 @ 5:25 PM 

Hi all,

Since the course is well and done now and the resource server defunct I’ve posted all the materia (notes, example code, etc) on this site. Hope it helps somebody at some point.

Click for the goods.

Peace.

Tags Categories: Uncategorized Posted By: bob
Last Edit: 08 Jan 2009 @ 05 27 PM

E-mailPermalinkComments (0)

Useful Documents:

Background:

The Pololu motor controller is a small serial device capable of driving two DC motors at currents of up to 1A each (though testing has shown this to be less). The command set is described in the manual above. Serial input must be TTL levels. Control is a fairly simple 3-4 byte sequence dependent on whether the device is being commanded or programmed. On the hardware side it has a standard DIP spacing with a single row of 9 pins. The driver is capable of supplying between 1.8-9V to the motors. It was used in the lab previously during the 2008 IARC competition.

Goal:

Create a computer based driver program for the Pololu motor controller. (All hardware has been implemented for you). The program should be capable of setting the speeds and the address of the motor controller. The program must consist of the following parts:

  • Driver base code

    • Functions to set speed and direction

    • Functions to set address

    • Error checking – functions should intelligently handle (and reject) bad input.

  • Menu code – should create a user navigable menu with the following structure:

    • Intro Page – Your name, name of program, functionality, brief description, etc

      • Speed Page

        • Speed Selection

        • Direction

        • Set Speed

        • Back

      • Programming Page

        • Single or Dual

        • Motor Number (or all)

        • Program

        • Back

      • Quit

  • Test Suite

    • Tests for the driver code (all/most possible inputs)

    • Tests for the programmer code (all/most possible inputs)

  • Build system

    • Makefile – Consisting of the following targets:

      • Build – compile the program fully

      • Clean – Delete all compiled code and intermediate files (Should not fail if files to be deleted are not present

      • Test – Should run your test suite (all output should be saved to files)

      • Run – Execute the compiled program – depends on Build

Other Notes:

  • Your code should not contain “magic numbers”

  • You code should not produce any output that the motor controller may not handle. Errors should be rejected gracefully. Tell the user what was wrong with the input.

Tags Categories: Uncategorized Posted By: bob
Last Edit: 19 Aug 2008 @ 07 50 AM

E-mailPermalinkComments (0)

 07 Aug 2008 @ 9:35 AM 

Week 8
8/12 - Pointers Quiz, HW4 Due (Make sure all 3 parts are done), Malloc/Free/Valgrind lecture
8/14 - HW5 due, Lab Time (HW7 Malloc/Free/Valgrind)

Week9
8/19 - Quiz (Structures, C Std. Lib, Bit Banging), HW6 Due, Project Unveiled (Hopefully), Data Structures lecture
8/21 - HW7 Due, Lab Time (HW8 Data Structures)

Week 10
8/26 - Quiz (Malloc/Free, Data Struct), HW8 Due, Overflow time(and/or assert() lecture)
8/28 - Lab Time (Projects)

Finals Week
Pass other tests, do your projects :-)

End of Week 1
9/26 - Projects Due - Dr. Oh gets grades 29th (no exceptions)

Tags Categories: Uncategorized Posted By: bob
Last Edit: 07 Aug 2008 @ 09 35 AM

E-mailPermalinkComments (0)

 27 Jun 2008 @ 10:37 AM 

You are writing code for a micro controller to make use of a distance sensor on a recent DASL project. The controller acquires input from the sensor using its integrated Analog-Digital converter (A/D). [For those who don’t know, an A/D converts voltage into some kind of floating point number based on the percentage of the observed voltage with respect to some maximal value. Wikipedia has more information for those interested].

  • The sensor will output a value between 0-5V based on the equation [d * 0.02V/in = v]
    • d = distance in inches
    • v = output voltage
  • The sensor’s output is the input to the A/D
  • For this specific A/D, the maximum input voltage is 5V.
  • The A/D will output to you a value that represents its input in percentage of maximum voltage on the range [0,1] (1 being 100%).
  • The output of the A/D is retrieved in code by calling the function converter()

Goal: Calculate the distance from the sensor to the surface (in inches) and print it to the terminal (use printf() )

A template source file has been provided in /home/c/code/week1/assign1/ad.c which contains a template main() and the converter() function. Copy this file to your home by doing the following:

  1. login
  2. cp /home/c/code/week1/assign1/ad.c ./    (don’t forget tab completion :-D )
  3. Before writing code, test compile
    1. gcc -Wall -o ad ad.c
  4. Run program
    1. ../ad     (the template will show no output, this is correct)

Once you have the file make sure you understand how I got to the results in the examples below (if you can’t figure out the math you can’t write the code.) Make sure to test compile to convince yourself the empty template is fine. Once you start working, don’t modify anything in the template code other then the “Your code here” line (your can add more then one line, however).

Things I’ll look for when grading:

  • Use meaningful variable names
  • Use comments when needed, but don’t insult a reader’s intelligence
  • Program provides correct output

One last note: The converter function prints its return value to the screen so you can check the results of your program by hand, I would suggest doing this.

Example 1:
converter() returns 0.25
0.25 indicates the A/D saw 25% of 5V = 1.25V
1.25V indicates that the surface is (1.25 / (0.02V/in)) in away = 62.5in
Your program should print 62.5in to the terminal

Example 2:
converter() returns 0.5
Your program should print 125in to the terminal

Tags Categories: Uncategorized Posted By: bob
Last Edit: 27 Jun 2008 @ 10 47 AM

E-mailPermalinkComments (0)

 24 Jun 2008 @ 10:34 AM 

Hi all,

The first thing you need to do in order to get up and running for the class is to install the remote access tools needed to use applications on the server I’ve set up. I’m running things this way because setting up these few programs is far easier then trying to walk everyone through the install of a full set of compilers/linkers/debuggers/etc and will allow everyone to get started right away, while using the same set of tools.

Windows Install Instructions: First, download Putty, an SSH client. Putty is a stand-alone executable and has no installer. Second, download and install Xming, a free X server for windows (this is needed for forwarding of the graphical elements of programs.)
Install Xming with the following options:

  • Install Directory: Doesn’t matter, just know where you put it.
  • Select Components Page: Select full installation and make sure the radio button for “Normal PuTTY Link SSH client” is selected
  • Start Menu Folder: Doesn’t matter so long as you know what it is.
  • Additional Tasks: Whatever floats your boat.

When the install is done, run the program. If window’s firewall prompts you, tell it to unblock the program. If you have other firewalls installed, make sure they allow outgoing connections on port 22. When you need to re-run the program at a later date, select the “Xming” option in the appropriate Start Menu folder (”Start->Progarms->Xming->Xming” by default).

Next, find the location where you downloaded Putty, run the program, and follow the screen shots.
On the front page fill in the host name as shown below:

Then, use the left hand navigation pane to switch over to the Connection->SSH->X11 page. Copy the settings as shown below.

Switch back to the front page, enter a name in the “Saved Sessions” box and click “Save” along the right hand side. When you use the program again later you will be able to simply double click the entry to get things started.

When this is done press the “Open” button to run the program.

You will be prompted with a question about a security key, answer “Yes”. Afterwards the program will prompt you for a username and password. These have been emailed to you (they are case sensitive). Once successfully logged in, type the command “gedit” and press enter. If the program runs and displays you are ready to go. Otherwise, contact me for help troubleshooting.

To rerun the programs make sure Xming is running, you will see an ‘X’ icon in the system tray, then launch Putty and conncet using the saved settings.

Tags Categories: Uncategorized Posted By: bob
Last Edit: 24 Jun 2008 @ 10 34 AM

E-mailPermalinkComments (0)

\/ More Options ...
Change Theme...
  • Users » 2
  • Posts/Pages » 6
  • Comments » 0
Change Theme...
  • VoidVoid
  • LifeLife « Default
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLight
  • No Child Pages.