User manual
PICDEM
TM
Mechatronics Demo Board User’s Guide
DS51557C-page 24 © 2006 Microchip Technology Inc.
FIGURE 2-5: PROJECT 2: SCHEMATIC
Instructions
Provide a light source for the light sensor and set Potentiometer 1 to the desired trip
point. Block the light source and LED1 should turn on. Experiment with the set point
and the amount to which you block the light from the sensor. Move your hand slowly in
front of the sensor and note that the LED does not flicker. This demonstrates how
software hysteresis prevents the output of the comparator from chattering near the trip
point.
Discussion
Comparators are found in many PIC microcontrollers due to the versatility and low cost
they offer the user. As you can see, the comparator is one of the more easily used
peripherals. Refer to the Comparator Tips ‘n Tricks pamphlet included on the CD in this
kit for more information on comparators.
PIC16F917
VDD
C1-
VSS
RD7
VDD
1 kΩ
R31
270 Ω
R36
30
11/32
2
12/31
D0
1 kΩ
R10
C1+
POT1
10 kΩ
VDD
7
6
4
VDD
VDD
GND
VBAT
5
C24
0.1
μF
TSL251RD
Light Sensor