Results
Initially, we had planned on our camera having two modes: automatic and manual. To achieve the automatic mode, we were going to mount a camera on the Nerf gun to be used to detect, aim, and fire at intruders. Due to time constraints, it was necessary to simplify our project to only use the manual mode incorporating the NS8 controller.
In our original design, we were going to use three timers, one for each servo, with each timer causing its own interrupt. However, we discovered that we only had two timers available to us when using the GPT, and all GPT timers would fire the same interrupt. This required a re-design of our ISR where we would detect which timer was causing the interrupt, and also meant that the two servos controlling horizontal and vertical movement would be handled by the same timer.
We had hoped to utilize the LCD’s busy signal when handling the timing of sending instructions to it. However, this would have required a number of changes to both the hardware and software handling of the LCD, and the increase in efficiency using this signal may have provided did not seem worth the risk of the potential problems from these changes given the time constraints. To ensure the LCD would not be busy when instructions were sent, we added a wait state that corresponded to the latency of instructions. At first we tried doing this in the hardware, by adding a counter that would delay when TA* was sent back to the processor, but then found it simpler to use a software approach to creating the wait state. We used a standard wait state for the majority of the instructions, which had equal latencies, and a longer one for the clear display instruction, since it took much longer for the LCD to execute.
Our NES8 controller provided two main issues. We had initially planned on having an interrupt fire off the ready bit from our NS8 controller so that we could read the data, before later switching to a timer approach. Getting the ready bit to work required multiple redesigns in order to get the timing and the shift registers working properly. The other main problem we had with the controller was one that we were unable to fix. We discovered that pressing some buttons on an angle would send false data through the NS8 controller, making it think that multiple buttons are being pressed at once. While the problems arising from this did help to expose some bugs in our ISR, the final result still was that the Nerf gun would move less smoothly if buttons were pressed incorrectly, occasionally causing the gun to stop moving altogether if too much of this occurred.