4.5. PICDEM Analog Sensors

• Light switch application

• Temperature display application

The mechatronics board is fitted with a light and temperature sensor, each of which produces an analog output in the range of 0–5 V. In common with many sensors now available, a signal conditioning amplifier is built in, so that no additional components are needed to interface with an MCU.

Light Sensor

The light sensor can be tested using the analog comparator inputs of the 16F917, which allow two input voltages to be compared. An output bit in a status register is set if the positive input (C+) is at a higher voltage than the negative input (C−) or a reference voltage. A range of setup options are defined in the header file.

The block diagram in Figure 4.11 ...

Get Programming 8-bit PIC Microcontrollers in C now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.