MORE RELATED

GROOMIX INFO
Blogs & Articles
MENU
. . .

programming

views : 168

Embedded program code in C language for Digital Voltmeter for AVR microcontroller

Digital voltmeter is very useful for accurate measurement of voltage. It has very small least count, depending on analog to digital convert (ADC) and least count of display. Here, seven segment display is used, however, any type of display can be used.

Image : project demonstrating model for Digital Voltmeter for AVR microcontroller

Embedded program code in C language

 Note : Pin connection should be in according to code below. if any confusion then ask in comments below...

 

//PROJECT NAME:digital voltmeter
//PB 0=BUZZER
//PB1=LDR SENSOR
//PC2=SMOKE SENSOR
//PC0=ANALOG INPUT(TEMPERATURE SENSOR)
//PC3,PC4,PC5=E,RW,RS( 16X2 LCD)
//PD=DATA(16X2 LCD)
#define F_CPU 12000000UL //Setting F_CPU to the frequency of the microcontroller
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
/*ADC Conversion Complete Interrupt Service Routine ()*/
ISR(ADC_vect);
////////////////////// ////////////////////////// ////////////////////////// ////
void InitADC()
{
    DDRC = 0b00111000;                    // Configure PortA as input
    ADMUX=(1<<REFS 0);                // For Aref=AVcc;
    ADCSRA=(1<<ADE N)|(7<<ADPS0);
}
int ReadADC(int ch)
{
   ch=ch&0b00000111 ;               //Select ADC Channel ch must be 0-7
   ADMUX|=ch;
   ADCSRA|=(1<<AD SC);               //Start Single conversion
   while(!(ADCSRA & (1<<ADIF))); &n bsp;  //Wait for conversion to complete
   ADCSRA|=(1<<AD IF);                   //Clear ADIF by writing one to it
   return(ADC);
}
////////////////////// ////////////////////////// //////////////////////////
#define SELECT_7SEG_DDR DDRC
#define SELECT_7SEG_PORT PORTC
#define DISP1 PC5
#define DISP2 PC4
#define DATA_DDR DDRD
#define DATA_PORT PORTD
char DECODE_7SEG[11] = {0x77,0x14,0xb3,0xb6,0xd4, 0xe6,0xe7,0x34,0xf7,0xf6,0 x08};
void DISPLAY_7SEG(int a)
{
SELECT_7SEG_DDR |= (1 << DISP1) | (1 << DISP2);
DATA_DDR = 0xff;   // port assigned as output
char char1;
char1 = a%10;
a = a/10;
char1 = DECODE_7SEG[char1];
SELECT_7SEG_PORT &= ~((1 << DISP1) | (1 << DISP2));
DATA_PORT = char1;
SELECT_7SEG_PORT |= (1 << DISP1);
char1 = a%10;
a = a/10;
char1 = DECODE_7SEG[char1];
SELECT_7SEG_PORT &= ~((1 << DISP1) | (1 << DISP2));
DATA_PORT = char1;
SELECT_7SEG_PORT |= (1 << DISP2);
}

int main()
{
DDRC &=~(1<<PC0);&nbs p;   //PC2=LOW INPUT FOR TEMPERATURE
DDRB|=0xFF;   ;          //Output for relays
PORTB = 0x00;        //INITIAL VALUE
InitADC();
unsigned int count;
while(1 )
    {
    int temp_int=ReadADC(0);     
    DISPLAY_7SEG(temp_in t/10);
 & nbsp;  for(count = 0; count<1000; count++)
        {
        DISPLAY_7SEG(temp_in t/10);
        }
     }
return 0;
}

For any query, feel free to comment below..... 

Posted By :
Mr. Unique

2016-09-09/06:21:11

Share this Page

Comments...

More :programming

programming
Arduino UNO tachometer coding with variable resistor and DC motor speed control
views :108

p

programming
Here is the code to interface 2 serial devices with AVR
views :112

p

programming
Software Uart for AVR microcontroller tested on 1200 baud rate
views :435

p

programming
ATMEL STUDIO-While loop conditioning issues
views :134

p

programming
ATMEL STUDIO-While loop is not working using interrupt incremented conditioning
views :246

p

programming
Copy and paste code for facebook share button in your websites
views :246
programming
How to program atmel 8051 family microcontroller? (step by step)
views :191
programming
Embedded program code in C language for Digital Voltmeter for AVR microcontroller
views :168
programming
Assemby program code for Automatic Door Opening System (8051 family microcontroller)
views :123
programming
Very simple and accurate Seven Segment Display program Code in Embedded C language
views :130

p

programming
Highway vehicle speed detector or checker Embedded C language code in MikroC AVR Framework also applicable for 8051 Microcontroller
views :83

p

programming
Assembly program for accurate 1 second delay function
views :131
programming
What is Embedded system programming?
views :149

Latest Updates

Breaking News
Best internet Recharge Plans than jio..!
views :103
Engineering Project Ideas
Vehicle Theft Protection Using Gsm
views :140
Engineering Project Ideas
DTMF Controlled Robot or Mobile Controlled Robot
views :83
Engineering Project Ideas
Digital Clock With Home Appliances Control Using Microcontroller
views :81
Engineering Project Ideas
Cooking Monitor
views :107
Engineering Project Ideas
Boundary Security System(Wireless)
views :93
Engineering Project Ideas
Automatic Garage Parking System
views :107
programming
Arduino UNO tachometer coding with variable resistor and DC motor speed control
views :108
Engineering Project Ideas
Employee Details Recording Interface synopsis
views :114
Engineering Project Ideas
Footstep Power Generation
views :90

---More To Do---

This pages is developed to give users a genuine web materials of all types throughout the world. Many articles, by experts are publishing here, every hours. You can publish your topics as well as you can comment on all posted topics and learn more. Many types of topics are published here like Technology based ( Electronics, Electricals, Mechanicals, civil engineering, computer science, programming and software development, Assemply language codings), Health like medicine, healthy diets, Homeopathy etc) and many types of latest news updates.


All content, design, and layout are Copyright © 2016 - Digital Photography Review All Rights Reserved. Reproduction in whole or part in any form or medium without specific written permission is prohibited.

MORE TO DO