Hardware Design

For moving the printer cartridge, we used the stepper motor that came with the printer but we interfaced to it directly. There are 256 steps along the width of the carriage. The stepper motor has two coils, which current is driven through using the four output pins, with two for each coil. To make the motor move one step, we reversed the direction of the current through one coil. In order to do this quickly for both coils, we used an H-bridge, which is typically used to reverse the direction in which a DC motor spins. The H-bridge has four input pins and four output pins. All four of the output pins were wired to the stepper motor, and the input pins were wired to testpoints. To reverse current in a coil, one input to the H-bridge needs to be changed while keeping the rest the same and the motor will make one step. To avoid unwanted inputs, only two control signals were wired to the stepper motor, A and B. The input to the other two pins on the H-bridge is the inverse of these inputs. To make the stepper motor move, we designed in Hardware a method to write a specific step position to a register, and the stepper motor would move to this position. This was done using Verilog, to compare the motors current position to the desired position, and driving the appropriate signals for A and B to the H-Bridge. We had to drive these signals at an optimal speed: too slow, and the paddle could not keep up with the ball, too fast, and the stepper motor would skip. This was done using a counter to divide the system clock and drive the signals at the correct speed.

To keep track of the ball for the computer player, we used eight pairs of lasers and photo-sensors. Using a resistor as the load of photo-sensor allowed us to pull a signal that represented if the ball was blocking this particular beam. We used inverter chips to push the analog signals which were not exactly 0V or 5V to whichever is closer (and then inverted them again). We used memory-mapped I/O to read these signals, and we also ORed all of the signals to throw an interrupt. The goal signal got its own interrupt line, which is higher priority than the position signals.

The Nintendo controller was one of the more difficult pieces of hardware for several reasons. The first of which is, just like Analog-to-Digital converter in Lab 8, the NES controller is extremely slow. To create the appropriate signals for it we wrote a finite state machine in Verilog. Once this was accomplished there were a few options for the method in which we received the data. The two biggest ideas were using an interrupt when it was finished, like Lab 8, or storing the data in a register and when reading, trigger the NES to read again and read the data contained in the register. This was the method we choose to use.

The hardware for the character display was not too difficult, the most difficult thing was deciding to reduce the bus clock speed from 25MHz to 10MHz. We ended up deciding that 10MHz would still be quick enough to move the Stepper Motor fast enough to follow the ball and make the timing for the display easier. From there it was just a simple mapping of pins and adding a potentiometer and a resistor to control the contrast.