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

Commit id: bcd161db72a91053465062473bea5c0e72167597

deletions | additions      

       

\subsubsection{Sending Signals to Servo Motors}  The servos are another significant electormechanical component as they are required to turn on the lights. The position of the servo is determined by the Pulse Width Modulation signal (PWM) coming from the PIC's RC2 port. The CCP1CON register was configured for PWM, the Timer2 was initialized and the duty cycle was set for both the "Lights On" (ON) Position and the "Lights Off" (Neutral) Position. The code for the neutral position of PWM is shown in Figure \ref{fig:SERVOS}.  \subsubsection{Determining Light Presence}  It was found that the yellow sensors were the most reliable and as such they were also used for presence detection. This was done by converting the voltage read at each sensor to a 10-bit binary number using ADC before the candlelights were turned on. The number was then compared to the threshold voltage rating of 0.8 V. If the voltage from the sensor was greater than 0.8, the light was considered not present as it meant the LEDs under the tray were shining through the holes. Conversely, if the voltage rating was less than 0.8 V it meant the light was present, so a temporary "pass" value was recorded. The code for  \subsection{Program Details}  \subsection{Suggestions for Improvement}