Hardware
As we know the most of PIC microcontroller has 8-bit/10-bit on-chip Analog to Digital converter module. In this project I use PIC16F676 which have ADC 10-bits 8 channel but this project use only one channel for measure voltage input for other pin set as digital I/O.
From the schematic above the input voltage divided by R1 and R2 (voltage divider).VR1 parallel with R2 use to adjust appropriate display full scale voltage.The divided input voltage will connected to AN3(RA4) which set as analog input.
RA0,RA1 and RA2 set as digital output to turn on/off the digits in scan dispay routine.
RA3 not use in this version and it was input only
RC0-RC5 and RA5 use to drives the segment of dispay(7-segment decoded by software)
RA0,RA1 and RA2 set as digital output to turn on/off the digits in scan dispay routine.
RA3 not use in this version and it was input only
RC0-RC5 and RA5 use to drives the segment of dispay(7-segment decoded by software)
Software
This project I use CCS C compiler to programming.The main routine continually read the input voltage on RA3 and convert to 7-segment code while TIMER1 set to timer for interrupt every 5mS for scan all digit about 66Hz(only one digit turn on at every 5mS).In convert digital value to voltage routine we must scale the value with the full scale display in this project I want full scale display at 30V so the input voltage must scaled with 30 and display resolution is 29mV or 30/1023. source code and shematic available here. |
0 comments:
Post a Comment
Note: only a member of this blog may post a comment.