Header Ads

Basic digital voltmeter(0-5V) use PIC16F877A and Mickro C

In this tutorial we will learn how to make digital voltmeter use microcontroller. Here I am use PIC16F877A microcontroller and LM16x2 Lcd display. You can watch the video  and read the written tutorial below.






PIC16F877A microcontroller has 8 channel ADC(Analog to Digital Converter) module. ADC module has software selectable high and low voltage reference input to some combination of VDD, VSS, RA2 and RA3. The ADC module recived analog signal and it convert 10 bit binary numbers. It can measure (0-5)V DC

.


Circuit Diagram






The A/D conversion of Analog input signal results in a corresponding 10 bit digital numbers.



0V     → 00 0000 0000
2.5V  → 00 1111  1111
5V      → 11 1111 1111

Calculation :

Resulation  = (5-0)/(1024-1)
                                 = 0.00488758
                                 =4.8875mV




Here,
       ADC read = 0 V                 (Microcontroller read)
      Actual Voltage = ADC read * Resulation
                              = 0 * 4.8875 mV
                              = 0V

Again,
           ADC read = 5 V
           Actual Voltage = ADC read * Resultion
                                   = 1024 * (5/1023)
                                   = 5.0048 V
                                   = ~5 V





ADC Library


ADC (Analog to Digital Converter) module is available with a number of PIC MCU modules. ADC is an electronic circuit that converts continuous signals to discrete digital numbers. ADC Library provides you a comfortable work with the module.


Library Routine


  • ADC_Init
  • ADC_Init_Advanced
  • ADC_Read
  • ADC_Get_Sample







Mikro C code :





Click the download button for hex code.
download

No comments

Theme images by 5ugarless. Powered by Blogger.