 Hello, Myself Pravindra Chauhan, Assistant Professor at Department of Electronics Engineering, Vulturest of Technology, Solapur. So in this session we will discuss how internal ADC of peak 16F877 can be used for different applications. Learning outcome, at the end of this session student can demonstrate the operation of ADC in peak 16F877 microcontroller. Also student can able to implement the peak ADC in different applications. Outline of this session, first special function registers associated with the ADC operation, then working of ADC and the setup for ADC implementation. Now ADC in peak 16F877 is having 8 analog channels, means through these 8 analog channels, one can apply the analog input to the peak ADC. And these 8 analog channels are defined on pin RA02 RA5 and RE02 RE2, means port A and port E pins are associating with the ADC operation. The A to D conversion of the analog input signal results in a corresponding 10 bit digital number, means the output of this ADC is of 10 bit. The 4 registers are associating with the ADC in peak controller and these registers are ADRESH, ADRESL, ADCON0 and ADCON1. Now ADRESH and ADRESL these 2 are called the result registers. The 10 bit digital output of the ADC that is the result of this ADC will get stored in ADRESL and ADRESH register. The 2 control registers are provided ADCON0 and ADCON1 to control the operation of the ADC. ADCCON0 register is shown here. The bit defined for this ADCON0 register are ADCS0, ADCS1, 3 channel select bits, then go slash done bar bit and LSB ADON bit. So when this ADCS1 and ADCS0 these 2 bits are called the conversion clock select bits. So ADC can operate on external clock as well as the internal clock. If ADCS1 and ADCS0 both are 0 then the ADC will operate on the clock which is equal to the oscillator frequency divided by 2. For 01 it will operate on oscillator frequency divided by 8 so on and if both the bits are 11 the ADC will operate on internal clock. The 3 channel select bits are provided that is CHS2 to CHS0. So 3 bits are provided because the ADC is having 8 analog inputs. So when these 3 channel select bits are 000 then the first channel that is the channel 0 which is called AN0 which is multiplexed with the pin RA0 that will be gate selected. In whatever the analog input applied on RA0 pin will gates converted into the digital and so on. To select the channel 1 that is AN1 makes CHS01 and other 2 bits 00 and so on. When all the 3 bits are set then the channel 7 which is multiplexed with the pin RA2 will be gate selected. Then GO slash done bar is called the A to D conversion status bit. Now this bit is having the meaning if ADON bit is 1. So if ADON is 1 and if we set the bit GO slash done bar then the ADC will start. Means when this bit is 1 one can know that the conversion is in progress. And when GO slash done bar reset it means that A to D conversion is not in a progress and this bit is automatically cleared by the hardware when A to D conversion is completed. ADON bit is used to enable or disable the ADC if 1 A to D converter module is operating if 0 A to D converter module is shut off. Means whenever you are going to use the ADC this must bit must be set. Then the second register ADCON1 register the bit format shown here. Now the MSB bit which is defined as ADFM which is called A to D result format select bit. If this is 1 the result will be write justified means 6 most significant bits of ADRSH are read as 0 and if this bit is reset then the result is less justified 6 least significant bits of ADRSL are read as 0. Then the port configuration control bits that is PCFG 3 to PCFG 0. Now as an example if all these bits are 0 0 all channels configured as a analog pins. If 0 0 0 1 then RA 3 can be used as V reference plus. If all these bits are 1 1 1 then RA 0 will be configured as analog pin RA 3 as a V reference plus RA 4 as a V reference minus and all others will be used as a digital pins. Now steps for A to D conversion first configure the ADC module. Now you think how to configure the ADC module in peak 16 of 877. Now to configure the A to D module first configure the analog pins slash voltage references and digital input output pin by making the use of ADCON 1 resistor. Then select the appropriate input channel select the clock for ADC conversion and turn on the ADC module. Now configure the ADC interrupt if required then wait the required acquisition time or call delay then start the conversion by using the bit go slash done bar then wait for A to D conversion to complete by either pulling for go slash done bit to be cleared or waiting for the ADC interrupt. Wait the result resistor pair that is ADRESH and ADRESL for further processing and clear the interrupt flag bit if required. References used for this the peak 16 of 877 datasheet and microcontrollers by Ajay Deshmukh. Thank you.