#include"lcd.h" #include "adc.h" #include "delay.h" double volt_read_disply(); int main(void) { int adc_value1=0; LCD_SetUp(PB_0,PB_1,PB_2,P_NC,P_NC,P_NC,P_NC,PB_4,PB_5,PB_6,PB_7); LCD_Init(2,16); adc_init(); LCD_Clear(); LCD_GoToXY(0,0); LCD_DisplayString(" g-Electron"); _delay_ms(1000); while(1) { adc_value1 = volt_read_disply(); LCD_GoToLine(1); LCD_DisplayString(" Volt : "); LCD_DisplayNumber(10,adc_value1,3); LCD_DisplayString("V"); _delay_ms(1300); } } double volt_read_disply() { int i,adc_value[40]={0}; int temp =0; adc_init(); for(i=0; i<40;i++) // samples taking from 41 times 9.4milli second taken about on complte half cycle { adc_value[i] = read_adc(0); // reading voltage } temp = adc_value[0]; for(i=0; i<40; i++) { if(temp<adc_value[i]) temp=adc_value[i]; } return ((double)temp*0.224828935); // int to double casting }
Design of Digital Voltmeter By using Micro-controller Part 2
By

Like This Post? Please share!
Subscribe through email and get Free updates
You May Also Like...
- Rotation Counter using 8051
- Rotation Counter using 8051
- Attepmt to Accessing Keyboad Up and down Key by C programm for a project
- Attepmt to Accessing Keyboad Up and down Key by C programm for a project
- Timer
- Timer
- Switch Bounce Tutorials
- Switch Bounce Tutorials
- Making multiple input by 3 wire Interfacing .
- Making multiple input by 3 wire Interfacing .
More Posts
gElectron. Powered by Blogger.
16x2 LCD Interfacing with STM32,STM32F103C6
16x2 LCD Interfacing with STM32,STM32F103C6 lcd_init(); LCD_LINE1; lcd_String(" GeElectron"); LCD_LINE2; lc...

Contact us
Follow Us
https://www.facebook.com/gElectron-393939667321867/
FBbox/https://www.facebook.com/IVYthemes
Comments
[blogger]
MKRdezign
Test
google.com, pub-8429441124104529, DIRECT, f08c47fec0942fa0
[blogger]
Latest
[recent][newsticker]
Technology
Top Ads
RECENT COMMENTS
Subscribe Via Email
Subscribe to our newsletter to get the latest updates to your inbox. ;-)
Your email address is safe with us!
Subscribe through email and get Free updates
Copyright © 2014 Embedded System Desgin • All Rights Reserved • Designed By Gelectron
Subscribe through email and get Free updates
Copyright © 2014 Embedded System Desgin • All Rights Reserved • Designed By Gelectron