Natalie C. Landon-Brace edited PIC.tex  about 10 years ago

Commit id: eeeb5547953882e540aaf9c6a31bee19b0de6c78

deletions | additions      

       

\subsubsection{Detecting and Interpreting User Input}  Both in standby mode and upon completion of the operation, the machine requires user input in order to proceed. In standby mode, the machine simply requires the operator to push <*> to start the checking operation. Upon completion of the program, the user is prompted to push for Operation Time, for a Summary (total number of lights tested, abbreviation for each light's status), for detailed light statistics (the status of an individual light) or to return to standby mode so the operation can begin again. During both of these times, the machine polls for input by displaying a message and continuing to check whether RB1 has been activated. Once RB1 has been activated, the key code RB7:4 is read in to the program. The keycode is then saved to a temporary register and exclusive or-ed with a preset code. The code for this can be seen in Figure \ref{fig:Button_Press}, which shows the checking routine for the <*> button. If the keycodes match (the result is 0) the subroutine associated with that keycode will execute. Otherwise, the keycode is reloaded from the temporary register and the process is repeated until a match is found, or all possibilities are exhausted. In the second case, the machine will maintain the same display.   \subsubsection{Sending Signals to Stepper Motors}  Stepper motors represent a significant component of the electromechanical design as they are needed to raise and lower the sensor array. Without this movement, the sensors would not be close enough to the lights to detect anything. As such, the PIC is required to send the stepper motors the required firing sequence the correct number of times to ensure that the array moves up and down the right amount. This was accomplished by calling the "STEPPER DRIVER" subroutine (which contained the firing sequence) in a loop the desired number of times (which was determined by trial and error). The firing sequence was sent by the PIC by setting the bits STEP_A, then STEP_C, then STEP_B, then STEP_D high to turn the motors forward. The reverse sequence (D, B, C, A) was sent to reverse the motion of the motors.  \subsection{Program Details}  \subsection{Suggestions for Improvement}