Simple Digital Voltmeter (DVM) using PIC16f877A (Code+Proteus simulation)
PIC16F877A based volt meter
This post provides a simple digital voltmeter circuit using PIC16f877A microcontroller. This code is written in C language using MPLAB X IDE with XC8 compiler.
In this post, it is assumed that you know,
- How to use ADC of PIC16F877A microcontroller.
- How to interface LCD with PIC16F877A microcontroller.
![]() |
Figure 1. Digital voltmeter using PIC16F877A |
In this circuit PORTB pins are used to interface LCD with PIC167877A microcontroller. The input to the digital voltmeter is given on the RA0 (or AN0) pin.
![]() |
Figure:2 Voltage divider network |
Using two resistors, R1 and R2, the input voltage ranging from 0-20V can be down
converted to 0-5V.
Calculation:
Voltage Divider Network:
Vout = Vin * R2 / R1+R2
Here Vin =13,R1=470K and R2=200k
Vout = 13*(200+670);
Vout = 13*(0.29850);
Vout = 3.88 volts;
ADC :
0 – 5 V Analog I/P is mapped to one of the 1024 levels (0-1023 Digital Count)
=> Resolution = 5/1024 = 0.00488 V/Count
Volt = ADC_Result * 0.00488 * 0.29850;
Coding:
![]() |
Figure 3: Pic16f877A voltmeter code |
Comments
Post a Comment