User manual
Robotics experiment with PIC microcontroller l 57
The one of most important function of mobile robot is interfacing the sensors. Robo-
PICA can interface with many type of sensors. Because it has both digital and analog
inputs. PIC16F887 the main microcontroller of Robo-PICA has many ports. We assign 9
programmable port pins for supporting the analog and digital sensors. In addtion 2 types
of serial coomunication ports; UART and I
2
C bus.
In this chapter, we will concentrate to interfacing with angalog sensors. The Robo-
PICA kit provides 2 kinds of analog sensors ; GP2D120 the infrared distance sensor and
ZX-03 Infrared Reflector sensors for line tracking activities.
5.1 PIC16F887’s A/D converter
PIC16F887 microconttroller contains 14-channel 10-bit analog to digital converter
module (ADC). All analog input ports can be configured to digital input and output. They
include RA0 to RA3, RA5, RB0 to RB5 and RE0 to RE2.
The Analog-to-Digital Converter (ADC) allows conversion of an analog input signal
to a 10-bit binary representation of that signal. This device uses analog inputs, which are
multiplexed into a single sample and hold circuit. The output of the sample and hold is
connected to the input of the converter. The converter generates a 10-bit binary result
via successive approximation and stores the conversion result into the ADC result registers
(ADRESL and ADRESH).
The ADC voltage reference is software selectable to either VDD or a voltage ap-
plied to the external reference pins.
5.2 ADC register
The important register of this module are ADCON0 and ADCON1 register. The
ADCON0 is used to select the analog pin fucntion and ADCON1 is used to select the
result data format and voltage reference.
Chapter 5
Contactless object detection