You are on page 1of 23

ADC

EXPLAIN THE ANALOGUE-TO-DIGITAL


CONVERTER

 ADC are among the most widely used devices


for data acquisition.

 Digital computers use binary (discrete) values,


but in the physical world everything is analog (continuous).

 ADC is use to convert analog signal to digital signal ,


so that microcontroller can read and process the signal
Example of Final Exam
Question 4a
Explain the Analog-to-Digital Converter (ADC) module in the PIC. (3m)

Answer:
• Analog are among the most widely used devices for data acquisition

• Digital computers use binary (discrete) values, but in the physical


world everything is analog.

• ADC is use to convert analog to digital signal, so that microcontroller


can read and process the signal.
EXPLAIN THE ANALOGUE-TO-DIGITAL
CONVERTER

Pg 5
The ELEVEN (11) pins which can read the analog voltage are mentioned in the
datasheet
ADC peripheral of PIC18

• 10-bit ADC
• 5 to 15 analog input channel depending on the
family
PIC18F4580 has 11 analog input channel
(AN0-AN10)
Register Associate

ADC is connect to the PIC CPU by 3 control register and 2 data register
– ADCON0 – Used to select analog input channel,start the conversion, check if
the conversion is done and to switch on/off the module. (We use this in
ADCRead() function.)
– ADCON1 – Used to Select Voltage reference, and to configure ports as
Analog of digital. (We leave these to defaults)
– ADCON2 – Used to select ADC data format, Set acquisition time, ADC clock
setup (We setup these in ADCInit() function)

• ADRESH - A/D Result High Register


• ADRESL - A/D Result Low Register
MUST ON when using ADC
Must SET here
To configure pin
Analog or digital
Holding capacitor (CHOLD) must be charged
to the input voltage to meet the accuracy
specified by the datasheet. So we must
provide a delay greater than the
minimum required acquisition time to
charge the capacitor. 19.72μs is the
minimum time specified in the
datasheet. Please refer the datasheet for
more details

A/D conversion clock must be


selected to ensure minimum TAD. TAD
is the conversion time per bit, which
is 1.6μs
GIVE EXAMPLES OF C PROGRAM TO READ
ANALOGUE SIGNAL FROM EXTERNAL DEVICES

Pg 13
GIVE EXAMPLES OF C PROGRAM TO READ
ANALOGUE SIGNAL FROM EXTERNAL DEVICES

Pg 14
Selection of A/D Conversion Clock
The time for A/D Conversion per bit is defined as TAD and it requires minimum 12TAD to generate the 10-bit
result. The time TAD is determined by the A/D Conversion Clock which is software selectable to following
options.
•  2 TOSC
• 4 TOSC
• 8 TOSC
• 16 TOSC
• 32 TOSC
• 64 TOSC
• Internal RC oscillator of ADC Module

• TOSC is the time period of the device clock usually provided by the crystal oscillator.
Care should be taken while selecting the A/D Conversion Clock, such that the clock should provide the
minimum TAD (1.6μS) required for the correct A/D Conversion. So refer the following table before setting
the ADC clock.
Characteristic of ADC

• Resolution
• Conversion Time
• Vref
• Digital Data Output
ADC Terminology

• RESOLUTION:
– indicates the number of discrete values it can produce
over the range of analog values.

– Higher the resolution smaller the step size


EXAMPLE:
you can say ADC have 2-bit resolution and you have a device which converts an analog
voltage between 0 and 10 volts into a 2-bit digital value for storage in a computer. This
device will give digital values as follows : Voltage 2-Bit Digital Representation
0 to 2.5 00
2.5 to 5 01
5 to 7.5 10
7.5 to 10 11
ADC Terminology

• STEP SIZE : the smallest change that can be


discerned by an ADC
Example:
» 10 bit ADC & Vref = 5V

Number of step = = 1024


Step size = Vref / =
5/1024
= 4.88mV
ADC Terminology

• REFERENCE VOLTAGE, Vref:


– input voltage for the reference voltage
– Used to detect step size

• DIGITAL DATA OUTPUT, Dout


– Output voltage
– Dout = Vin / Step size
= 1.7v / 4.88mV
= 348 (in decimal)
= 101011100 (in binary)
2-bit resolution
No of step = 4

Step Size
Example of Final Exam
Question 4b
• An 8 bit ADC has reference voltage, Vref = 5 V. If the analog input is 4.5 V, calculate
the digital value produced by the ADC in hexadecimal.(6m)

Answer:
• No. of step = 2n = 256
• Step size =
= = 0.01953
 
• Dout =

230 = E6 H
Example of Final Exam
• An ADC module inside PIC Microcontroller is used to convert analog signal from MaxSonar
ultrasonic sensor. The specification analog output from sensor is illustrated in Figure A4
(b). If the ADC module is used with following setting:
– Resolution = 10-bit
– Vref(+) = 3V
– Vref(-) = 0V

Calculate Digital Output, if sensor detect object 10cm in front of sensor.


Answer

You might also like