This is an upgrade to recently published Simple Digital Voltmeter.Few improvements were done to hardware and software.DVM operating range was slightly increased up to 24 V Max, however the most significant change is that the code now uses full 10 bit of ADC resolution to calculate the voltage being measured allowing 3 Digit result for 0-9.99 range and 4 digits for 10.00-24.00 range. Also generic Common Cathode 7-Segments
PIC16F877A
Basically now 10 bits of ADC are multiplied by 4 to achieve 4096 V reading as a full scale and again by 8 to offset constant resistor 1:8 Voltage Divider at the input. Next the result is converted to unpacked BCD digits and sent to 7-Segment Display. Due to second multiplication by 8 the last digit is not displayed but can be easily recovered if needed. In order to get a good measuring result pay attention to power supply especially to filtering capacitors connected to voltage regulator like 7805
Tip for using Generic 7-Segment: Usually datasheet for generic parts can be difficult to find. For this project we need to know where the segment inputs are located. This can be done by using a Diode DVM function. Just connect one of DVM wires to arbitrary chosen 7-Segment pin and cycle through remaining pins until the segment is ON. Do it for additional few segments and you’ll know where the Common and individual pins are located. Max voltage reading test was done with DC Power Supply
As future improvement auto range capability can be added. Constant resistor divider can be replaced by a digital switch like CD4066