Embedded Projects Blog: PC Based Voltmeter Using C#

PC Based Voltmeter Using C#

Voltmeter C# Arduino, PIC, AVR



This program is developed in C# (C sharp). It needs .NET framework 4.0 to work.  For the circuit and other details of the project go to the Link. Click on the image to download the program.










Code modification of existing project





/**********************************************/
/*
  
 http://www.facebook.com/EmbeddedProjects

 http://microcontrollerprojects00.blogspot.in/

 Author: Vishal K M

 uC:16F877A
 Compiler: mikroC
 Crystal freq: 4MHz


                                              */
/**********************************************/





unsigned long temp;
unsigned int i;
char digit[]="0.000";

void main() {


TRISA=0xFF;

ADCON0=0x01;
ADCON1=0x0E;
UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize
 
   UART1_Write_Text("Embedded Projects");
   UART1_Write(0x0D);

  do {
    temp = ADC_Read(0);   // Get 10-bit results of AD conversion
    temp=temp*5000/1023;   //Convert ADC value to mV
   
   

    digit[0]=(temp/1000)+48;
    digit[2]=((temp%1000)/100)+48;
    digit[3]=(((temp%1000)%100)/10)+48;
    digit[4]=(((temp%1000)%100)%10)+48;
   
    UART1_Write_Text(digit);

      //Carriage Return
    Delay_ms(1000);

  } while(1);
}

1 comment: