Hello

Welcome lekule blog

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation.
together in the world. #lekule86
Join us on

ADC (Analog to Digital Converter) Module in PIC Microcontroller

There are various electrical signals in nature are analog, that means a quantity change directly with another quantity. Where the first quantity is voltage while another quantity can be anything like force, temperature, light accelerations and pressure. For instance, in IC LM35 temperature sensor the o/p voltage changes depending on the temperature, so if we could measure voltage, we can calculate the temperature. But, most of the microcontrollers are digital in nature. They can only distinguish between low or high level on i/p pins.
For example, if i/p is greater than 2.5v then it will be read as high (1) and it is less than 2.5v then it will be read as low (0). So we cannot directly measure voltage from microcontrollers. To rectify this problem most of the microcontrollers have analog to digital converter unit which will convert from a voltage to a number so that it can be handled by a digital system like microcontrollers. This allows us to interface all types of analog devices with microcontroller unit. Some examples of an analog devices are temperature, light, touch, accelerometer and microphone for recording of audio. Please follow the following link for  : Types of analog and digital sensors with applications.
ADC in PIC Microcontroller
ADC in PIC Microcontroller

Analog to Digital Converter in PIC Microcontroller

Analog to digital converter in PIC microcontroller is discussed below.

PIC Microcontroller

The term PIC stands for programmable interface controllers, which can be pre programmed to carry out a huge variety of tasks. The production line can be controlled by a preprogrammed microcontroller with timers. The applications of PIC microcontrollers mainly involve in various electronic devices like electronic gadgets, computer control systems, alarm systems.
PIC Microcontroller
PIC Microcontroller

Different types of PIC microcontrollers exist, while the finest are probably found in the GENIE range of programmable microcontrollers. PIC microcontrollers are programmed and replicated by circuit wizard software. These microcontrollers are somewhat inexpensive and can be bought as kits or pre-built circuits that can be designed by the user.

Analog to Digital Conversion

Analog to digital converter is essential in an embedded system because, while these systems deal with digital values, their surrounds usually involve various analog signals. These signals need to be changed into digital before being treated by the microcontroller. Currently, we can see how to read an exterior analog signal using PIC microcontroller and display the digital output conversion on an LCD display. The input signal will be a changing voltage between 0 to 5v.
Analog to Digital Conversion
Analog to Digital Conversion

The most important specification of analog to digital converter is the resolution. This specifies how exactly the ADC measures the analog i/p signals. The common ADCs available in the market are 8-bit, 10-bit and 12-bit. For instance, the reference voltage of ADC is 0-5 volts, then a 8-bit analog to digital converter will break this voltage into 256 parts. So it can calculate it exactly up to 5/256v= 19mV approx. While the 10-bit analog to digital converter will break the voltage into 1024parts. So it can calculate it exactly up to 5/1024= 4.8 mV approx.. So you can observe that the 8-bit ADC cannot tell the variation between 1mV & 18mV. The analog to digital converter in PIC microcontroller are 10-bit.

The other specification of the ADC is the sampling rate, that specifies how fast the A/D converter can take readings. Microchip claims the ADC of the PIC can go high as 100k samples/Sec.

ADC in PIC Microcontroller

Analog to digital conversion module in PIC microcontroller usually has 5-i/ps for 28-pin devices and also 8-i/ps for 40-pin devices. The change of analog signal to the PIC , ADC module effects in equivalent 10-bit digital number. The ADC module with microcontroller has a software selectable low and high voltage reference i/p to some combination of VSS, VDD, RA2 & RA3. In the following project we will convert analog input to digital number with high voltage reference and low voltage reference. The o/p will be shown using LEDs. You can alter the reference voltages by arranging the ADCON1 register.

Circuit Diagram of ADC in PIC Microcontroller

The circuit diagram of the 10-bit analog to digital converter using PIC microcontroller is shown below. The test i/p voltage of ADC is received from a 5k potentiometer connected across the potentiometer, and it connects to the two pins (AN2/RA2) of the PIC microcontroller.The power supply is selected as the reference voltage for analog to digital conversion. Thus, the 10-bit A/D converter will change any analog voltage to a digital. The output will be displayed on the LCD display.
Circuit Diagram of ADC in PIC Microcontroller
Circuit Diagram of ADC in PIC Microcontroller

Software Required

The programming of A/D conversion in PIC microcontroller includes arranging the registers like ADCON0, ADCON1 and ANSEL.
  • ADCON0 register is used to choose the analog i/p channel, start the conversion and to check the conversion is completed or not and also switch ON/OFF the module.
  • ADCON1 register is used to choose voltage reference, and to arrange ports as an analog to digital
  • ADCON2 register is used to choose the A/D data format, fix a acquisition time, A/D clock setup.
As an analog input AN2/RA2 is used, the equivalent ANSEL register must be fixed. In register ADCON0, clear HS0 & CHS2 and set CHS1, so that the channel AN2 will be associated with the internal S&H circuit (sample and hold circuit). In the ADCON1 register, clearing the VCFG bit will choose the voltage supply for analog to digital conversion. This register is used to select the CLK source in analog to digital conversion. Though, the MikroC Pro for microcontroller has got a built in library function termed as ADC_Read (), by default, uses the internal RC CLK for ADC operation.So no need to reset the ADCON1 register.


Thus, this is all about analog to digital converter in PIC microcontroller, which includes what is a PIC microcontroller, analog to digital converter, ADC in PIC microcontroller and the required software. We hope that you have got a better understanding of this concept. Furthermore, any queries regarding this concept or PIC Microcontroller Projects or electrical and electronic projects, please give your valuable suggestions by commenting in the comment section below.Here is a question for you, what are the applications of analog to digital converter?

Share this:

ABOUTME

Hi all. This is deepak from Bthemez. We're providing content for Bold site and we’ve been in internet, social media and affiliate for too long time and its my profession. We are web designer & developer living India! What can I say, we are the best..

Post a Comment
My photo

Hi, I`m Sostenes, Electrical Technician and PLC`S Programmer.
Everyday I`m exploring the world of Electrical to find better solution for Automation. I believe everyday can become a Electrician with the right learning materials.
My goal with BLOG is to help you learn Electrical.

Labels

EDITORIALS ARTICLES LEKULE TV DC ROBOTICS DIGITAL SEMICONDUCTORS GENERATOR AC EXPERIMENTS MANUFACTURING-ENGINEERING REFERENCE FUNDAMENTAL OF ELECTRICITY ELECTRONICS ELECTRICAL ENGINEER MEASUREMENT TRANSDUCER & SENSOR VIDEO ARDUINO RENEWABLE ENERGY AUTOMOBILE TEARDOWN SYNCHRONOUS GENERATOR DIGITAL ELECTRONICS ELECTRICAL DISTRIBUTION CABLES MICROCONTROLLER AUTOMOTIVE SOLAR PROTECTION DIODE AND CIRCUITS ELECTRONICS BASIC ELECTRICAL MOTOR SWITCHES CIRCUIT BREAKERS CIRCUITS THEORY PANEL BUILDING ELECTRONICS DEVICES MIRACLES SWITCHGEAR ANALOG MOBILE DEVICES WEARABLES CAMERA TECHNOLOGY COMMUNICATION GENERATION BATTERIES FREE CIRCUITS INDUSTRIAL AUTOMATION SPECIAL MACHINES ELECTRICAL SAFETY ENERGY EFFIDIENCY-BUILDING DRONE CONTROL SYSTEM NUCLEAR ENERGY POWER SMATRPHONE FILTER`S BIOGAS BELT CONVEYOR MATERIAL HANDLING RELAY ELECTRICAL INSTRUMENTS ENERGY SOURCE PLC`S TRANSFORMER AC CIRCUITS CIRCUIT SCHEMATIC SYMBOLS DDISCRETE SEMICONDUCTOR CIRCUITS WIND POWER C.B DEVICES DC CIRCUITS DIODES AND RECTIFIERS FUSE SPECIAL TRANSFORMER THERMAL POWER PLANT CELL CHEMISTRY EARTHING SYSTEM ELECTRIC LAMP FUNDAMENTAL OF ELECTRICITY 2 BIPOLAR JUNCTION TRANSISTOR HOME AUTOMATION 555 TIMER CIRCUITS AUTOCAD BLUETOOTH C PROGRAMMING HYDRO POWER LOGIC GATES OPERATIONAL AMPLIFIER`S SOLID-STATE DEVICE THEORRY COMPUTER DEFECE & MILITARY FLUORESCENT LAMP INDUSTRIAL ROBOTICS ANDROID ELECTRICAL DRIVES GROUNDING SYSTEM CALCULUS REFERENCE DC METERING CIRCUITS DC NETWORK ANALYSIS ELECTRICAL SAFETY TIPS ELECTRICIAN SCHOOL ELECTRON TUBES FUNDAMENTAL OF ELECTRICITY 1 INDUCTION MACHINES INSULATIONS USB ALGEBRA REFERENCE HMI[Human Interface Machines] INDUCTION MOTOR KARNAUGH MAPPING USEUL EQUIATIONS AND CONVERSION FACTOR ANALOG INTEGRATED CIRCUITS BASIC CONCEPTS AND TEST EQUIPMENTS DIGITAL COMMUNICATION DIGITAL-ANALOG CONVERSION ELECTRICAL SOFTWARE GAS TURBINE ILLUMINATION OHM`S LAW POWER ELECTRONICS THYRISTOR BOOLEAN ALGEBRA DIGITAL INTEGRATED CIRCUITS FUNDAMENTAL OF ELECTRICITY 3 PHYSICS OF CONDUCTORS AND INSULATORS SPECIAL MOTOR STEAM POWER PLANTS TESTING TRANSMISION LINE APPS & SOFTWARE C-BISCUIT CAPACITORS COMBINATION LOGIC FUNCTION COMPLEX NUMBERS CONTROL MOTION ELECTRICAL LAWS INVERTER LADDER DIAGRAM MULTIVIBRATORS RC AND L/R TIME CONSTANTS SCADA SERIES AND PARALLEL CIRCUITS USING THE SPICE CIRCUIT SIMULATION PROGRAM AMPLIFIERS AND ACTIVE DEVICES BASIC CONCEPTS OF ELECTRICITY CONDUCTOR AND INSULATORS TABLES CONDUITS FITTING AND SUPPORTS ELECTRICAL INSTRUMENTATION SIGNALS ELECTRICAL TOOLS INDUCTORS LiDAR MAGNETISM AND ELECTROMAGNETISM PLYPHASE AC CIRCUITS RECLOSER SAFE LIVING WITH GAS AND LPG SAFETY CLOTHING STEPPER MOTOR SYNCHRONOUS MOTOR AC METRING CIRCUITS BECOME AN ELECTRICIAN BINARY ARITHMETIC BUSHING DIGITAL STORAGE MEMROY ELECTRICIAN JOBS HEAT ENGINES HOME THEATER INPECTIONS LIGHT SABER MOSFET NUMERATION SYSTEM POWER FACTORS REACTANCE AND IMPEDANCE INDUCTIVE RECTIFIER AND CONVERTERS RESONANCE SCIENTIFIC NOTATION AND METRIC PREFIXES SULFURIC ACID TROUBLESHOOTING TROUBLESHOOTING-THEORY & PRACTICE 12C BUS APPLE BATTERIES AND POWER SYSTEMS DC MOTOR DRIVES ELECTROMECHANICAL RELAYS ENERGY EFFICIENCY-LIGHT INDUSTRIAL SAFETY EQUIPMENTS MEGGER MXED-FREQUENCY AC SIGNALS PRINCIPLE OF DIGITAL COMPUTING QUESTIONS REACTANCE AND IMPEDANCE-CAPATIVE SEQUENTIAL CIRCUITS SERRIES-PARALLEL COMBINATION CIRCUITS SHIFT REGISTERS WIRELESS BUILDING SERVICES COMPRESSOR CRANES DIVIDER CIRCUIT AND KIRCHHOFF`S LAW ELECTRICAL DISTRIBUTION EQUIPMENTS 1 ELECTRICAL DISTRIBUTION EQUIPMENTS B ELECTRICAL TOOL KIT ELECTRICIAN JOB DESCRIPTION INDUSTRIAL DRIVES LAPTOP SCIENCE THERMOCOUPLE TRIGONOMENTRY REFERENCE UART oscilloscope BIOMASS CONTACTOR ELECTRIC ILLUMINATION ELECTRICAL SAFETY TRAINING ELECTROMECHANICAL FEATURED FILTER DESIGN HARDWARE JUNCTION FIELD-EFFECT TRANSISTORS NASA NUCLEAR POWER VALVE COLOR CODES ELECTRIC TRACTION FLEXIBLE ELECTRONICS FLUKE GEARMOTORS INTRODUCTION LASSER PID PUMP SEAL ELECTRICIAN CAREER ELECTRICITY SUPPLY AND DISTRIBUTION MUSIC NEUTRAL PERIODIC TABLES OF THE ELEMENTS POLYPHASE AC CIRCUITS PROJECTS REATORS SATELLITE STAR DELTA VIBRATION WATERPROOF