Indiana University Bloomington

School of Informatics and Computing


Computer Science Program







 Home

 Contacts

 Courses

 Academics

 Careers

 Research

 People

 Calendar

 Resources

 Facilities
   FAQ
   System Notices
   Help
   Hardware
   Software
   Network
   Policies
   Lindley Hall

Driver Software for the Wheel Speed Board


             Here is a picture of the wheel speed board in LH035.

A piece of software has been written to drive the wheel speed simulator board in the LH035 lab. The software has been broken into multiple files for modularity.

The source for the software can be obtained by downloading  and unzipping the following file.

Here is a brief description of the pieces of the build.

1.) Vector table initialization (vector.s)
The driver software is driven off of a timer interrupt. Using the timer interrupt requires that the address of the interrupt service handler be placed in the 68040's
interrupt vector table. The initialization of the vector table is included in this file.

Note:  Once you have built the driver software and plan to load it into the debugger, you must set a debugger variable that tells the debugger to allow  you to "take over" the vector for the timer. To do this, type the following command into the command line interface of the debugger BEFORE you download the code.

set vectskip = ( 200 )

If you do not do this, the debugger will not allow the address of the timer interrupt handler in this code to be placed in the vector table. When the timer interrupt expires,  the debugger will display a dialog box indicating that an unexpected exception has occurred.

2.) Variable Space Reservation (global.s)
All of the variable creation (ds.x) statements are included in this file along with a routine to initialize all of the variables. Two assembly directives are used to allow
visibility of the variables from other files. XDEF allows a variable created in a file to be used by another file. XREF allows a file to use a variable that
was created in an external file (assuming that the variable was marked for export with the XDEF directive in the external file).

3.) Main execution path

Program main (dev_main.s)

  • Initialize variables (global.s):
  • Initialize the timer (timer.s): When this completes, a timer interrupt will occur every 256uS. The interrupt will cause the address at vector number to be executed every time that the timer expires.  At download the address for vector 200 in the vector table is replaced by the timer interrupt handler.
  • Loop at this point forever
4.) Timer Interrupt path

Timer Interrupt Handler (timer.s)

  • Scheduler (schedule.s): The scheduler keeps track of time intervals by counting each time that the interrupt handler executes. For example, if a piece of code needs to execute every 10 ms, the scheduler would count up to 39 (10ms/256us=39) before executing the code. The scheduler maintains several counters for different time periods (ie. 1ms, 10ms, 100ms, etc).
    • 260uS interval:
      • Track wheel speed  (wspd.s): Routine polls the parallel port to detect and measure the period of the pulses coming from the speed sensors.
      • Update motor drive PWM (pwm.s): Routine creates a fixed frequency, variable duty cycle square wave that is used to drive the motors at a speed proportional to the duty cycle.
    • 200mS interval:
      • Control functions to regulate motor speed (mctrl.s):
    • Other time slots: 
      • None currently used.
5.) Makefile

A makefile has been provided to allow the code to be rebuilt efficiently as changes are made. The utility, nmake, can be executed while in the directory with the
source/makefile and the code will be built.  Nmake is a tool that is provided with MS Visual Studio.

Go to this link for more information on makefiles. "Make" Utility Basics

Go to this link for some information on an issue that I have encountered using makefiles with the SDS tools. The workspace for the motor driver software is at this link.  Important Information Regarding Using "Make/Nmake" with the SDS Debugger

6.) *.spc files
There are a couple of *.spc files included with the source. One file is the link.spc file. As with previous lab assignments, this file is used by the linker to determine how to take the individual pieces of the build and physically construct the *.out file.

The other file is called in_file.spc. This is used in the makefile. Take a look in the makefile where the linker is invoked. in_file.spc contains a list of the
different  object files that are part of the build. You could specify the *.o files to the linker without this file if there were not very many files.
When the number of object files gets bigger than 3 or 4,  use a file to specify the files the linker to prevent an overflow on the command line.
 
 
 
 








Valid HTML 4.01!