Professional Documents
Culture Documents
Digital Volt Meter by Using PIC16F877A: Software Used
Digital Volt Meter by Using PIC16F877A: Software Used
Software used:
1) Proteus 7.7 for simulation
2) MickroC Pro v4.15 for code compiling and HEX file
Circuit Diagram:
CODE:
/*Header******************************************************/
//
// Declare variables
char *text;
//
long tlong;
//
void main() {
INTCON = 0;
TRISA = 0x04;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
2
Lcd_Cmd(_LCD_CLEAR);
ADCON1 = 0x82;
TRISA = 0xFF;
Delay_ms(1000);
introduction (void);
text = "voltage:";
Delay_ms(1000);
while (1) {
adc_rd = ADC_Read(2);
Lcd_Out(2,1,text);
// from result
Lcd_Chr(2,9,48+ch);
Lcd_Chr_CP('.');
ch = (tlong / 100) % 10;
Lcd_Chr_CP(48+ch);
Lcd_Chr_CP('V');
Delay_ms(1);
}
3