Navigation bar
  Print document Start Previous page
 5 of 7 
Next page End  

SOFTWARE DESIGN
The software was centered around the interrupt service routine(ISR). The only thing that
the main project file did was set up the ISR then spin. The ISR essentially consisted of
the N64 handling routine. Walking through handling an N64 request will explain the ISR
fully.
The first thing that happens is a request. This is an interrupt set on a general purpose
timer which goes off every 2 ms. This sends a write to the N64 hardware controller.
When the hardware controller is done, it sends an interrupt back, which goes to the N64
button handler routine. This loads the values of the buttons from the hardware, then
branches to the appropriate button function. These functions are listed above.
Some functions of note are the L, R, and A buttons. The L and R button functions
actually turn off all interrupts except for a real time clock handler. This handler
essentially waits one second, then turns everything back on. This function is to wait for
the servo to turn the robot body, since this happens in real time.
The A button is fairly complex. This enters the robot into the sensor mode handler. The
robot turns its body to a certain position(using the same functionality as L and R). It then
sends a request to the sensor. The sensor controller sends an interrupt back to the
processor, then the processor stores the sensor data(the distance). The handler goes
through all 5 positions that the body can take, all the while storing the minimum distance,
and its body position. When it is done taking sensor samples, it writes the body position
(turning it), then sends the command to fire the gun.