You are on page 1of 6

INTRODUCTION TO ANALOG TO DIGITAL

CONVERTION (ADC)
Objective:

Ability
Ability
Ability
Ability

to
to
to
to

create project using MPLAB IDE.


understand the function of ADC.
write the ADC programming .
use MPLABSIM tools to debug coding.

Introduction:
This module will introduce how to use MPLAB IDE to create a new project by
selecting PIC type and compiler. We are working under Hi-tech compiler to
compile our programming, this compiler is easier to use competed to others
because mostly example in the internet using this compiler.
Analog to digital converters (ADC) are among the most widely used devices for
data acquisition. Digital computers use binary values. Transducers are also refer
as sensors, reading physical environment quantities produce an output that is
voltage. Therefore, we need a ADC to translate the analog signals to digital
numbers so that the microcontroller can read and process them.
After we are finish writing and compile the program then we will learn about
MPLABSIM tools. This tools is very important to us to know that our program is
working correctly or not. From this tools we can see the signal are generated by
our PIC microcontroller, so we can analyze the signal came up from port,
calculating timer and others.

PIC 18 ADC Resolution is 10-bit


Table: Vref , 10-bit resolution.

ADCON0 register:

ADCON1 register:

ADMF register:

Example:
Setup:

Timer calculation:

**but the convertion cannot be faster then 1.6us.

Table: lm35sensor step size:

LAB:
1. Create new project.
2. Insert C and H file (given in CD).
3. Compile.
4. Correct Error.
5. Run debugger MPSIM.
6. Observation (see the related between code and application).
7. Load into board.
8. Push RESET Button.
9. Explanation.
10.Solve new tasks (can be in group or personally).
** if have question, you can ask instructor any time.. ;-)

You might also like