PROYECT: VOLTMETER with PIC 16F877A

General discussion on mikroC PRO for PIC.
Post Reply
Author
Message
Robo3001
Posts: 3
Joined: 05 May 2009 12:07
Location: Perú-Trujillo
Contact:

PROYECT: VOLTMETER with PIC 16F877A

#1 Post by Robo3001 » 05 May 2009 12:35

Hello, here I present this project: "Voltmeter 0-50v, is comprised of a LCD and 1 pic 16f877A :wink:

/* Hola presento este proyecto básico:Voltimetro de 0-50v, esta conformado por un LCD y un PIC 16f877A */

Code: Select all

//LCD: configuración de pines
sbit lcd_rs at rb2_bit;
sbit lcd_en at rb3_bit;
sbit lcd_d7 at rb7_bit;
sbit lcd_d6 at rb6_bit;
sbit lcd_d5 at rb5_bit;
sbit lcd_d4 at rb4_bit;
//LCD: direccionamiento de pines
sbit lcd_rs_direction at trisb2_bit;
sbit lcd_en_direction at trisb3_bit;
sbit lcd_d7_direction at trisb7_bit;
sbit lcd_d6_direction at trisb6_bit;
sbit lcd_d5_direction at trisb5_bit;
sbit lcd_d4_direction at trisb4_bit;

unsigned long adc_value;
unsigned char d1,d2,d3,d4;

#define printV     lcd_chr(2,11,48+d1);    lcd_chr_cp(d2+48);                  \
                   lcd_chr_cp('.');        lcd_chr_cp(48+d3);                  \
                   lcd_chr_cp(48+d4);      lcd_chr_cp('V');
                   
#define calcV      d1=adc_value/1000;             d2=(adc_value%1000)/100;     \
                   d3=((adc_Value%1000)%100)/10;  d4=((adc_value%1000)%100)%10;
                   
void main()
{
 ADCON1=0b10000010;
 TRISA=0XFF;
 Lcd_Init();
 lcd_cmd(_LCD_CLEAR);
 lcd_cmd(_LCD_CURSOR_OFF);
 Lcd_Out(1,2,"EVA  PROYECT's");
 lcd_out(2,1,"voltage:");
 for(;;){
         adc_value=ADC_Read(0);
         adc_value=adc_value*5000/1023;
         calcV
         printV
         delay_ms(20);
        }
}


SCHEMATIC (esquemático):
http://www.fileden.com/files/2008/9/15/ ... EMATIC.bmp

Acetronics
Posts: 715
Joined: 27 Dec 2006 14:33
Location: Le Tréport , FRANCE

#2 Post by Acetronics » 05 May 2009 16:50

Hi, Robo

The indians are arriving ... :lol:

I see smoke from RV1 and R1, R2 ...

Ahhhh ... It's a pity simulators do not ALSO produce the smoke !!! :wink:

Alain

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#3 Post by Mince-n-Tatties » 05 May 2009 18:09

Acetronics wrote:Hi, Robo

The indians are arriving ... :lol:

I see smoke from RV1 and R1, R2 ...

Ahhhh ... It's a pity simulators do not ALSO produce the smoke !!! :wink:

Alain
looks perfectly fine. the only output connected to the pic from this R network is CH0 and this is 5 volt max.

you may have mistaken RV1 AN0 as being connected to the pic, but looking at the schematic AN0 is the output of RV1 and feeds divider R2/R1.

no smoke and the simulator in this case reports the correct outcome.

Robo3001
Posts: 3
Joined: 05 May 2009 12:07
Location: Perú-Trujillo
Contact:

#4 Post by Robo3001 » 06 May 2009 04:08

English: 8)
Thats right, the output of RV1 is AN0 and this then connects to R2,the PIC reads the value of R1 (CH0 output) voltage through a divider, the reading value is from:0v to 5V

Spanish: :o
El voltaje de salida del potenciometro es anotado por el punto AN0 y este se conecta a R2 donde por leyes básicas el voltaje que se va a tomar de CH0 sería la décima parte de AN0

Mince-n-Tatties
Posts: 2780
Joined: 25 Dec 2008 15:22
Location: Scotland

#5 Post by Mince-n-Tatties » 06 May 2009 10:43

Robo3001 wrote:English: 8)

Spanish: :o
its ok "schematic" is an international language :wink:

kashifmirza
Posts: 16
Joined: 26 Jan 2019 14:58

Re: PROYECT: VOLTMETER with PIC 16F877A

#6 Post by kashifmirza » 03 Aug 2019 14:23

Robo3001 wrote:Hello, here I present this project: "Voltmeter 0-50v, is comprised of a LCD and 1 pic 16f877A :wink:

/* Hola presento este proyecto básico:Voltimetro de 0-50v, esta conformado por un LCD y un PIC 16f877A */

Code: Select all

//LCD: configuración de pines
sbit lcd_rs at rb2_bit;
sbit lcd_en at rb3_bit;
sbit lcd_d7 at rb7_bit;
sbit lcd_d6 at rb6_bit;
sbit lcd_d5 at rb5_bit;
sbit lcd_d4 at rb4_bit;
//LCD: direccionamiento de pines
sbit lcd_rs_direction at trisb2_bit;
sbit lcd_en_direction at trisb3_bit;
sbit lcd_d7_direction at trisb7_bit;
sbit lcd_d6_direction at trisb6_bit;
sbit lcd_d5_direction at trisb5_bit;
sbit lcd_d4_direction at trisb4_bit;

unsigned long adc_value;
unsigned char d1,d2,d3,d4;

#define printV     lcd_chr(2,11,48+d1);    lcd_chr_cp(d2+48);                  \
                   lcd_chr_cp('.');        lcd_chr_cp(48+d3);                  \
                   lcd_chr_cp(48+d4);      lcd_chr_cp('V');
                   
#define calcV      d1=adc_value/1000;             d2=(adc_value%1000)/100;     \
                   d3=((adc_Value%1000)%100)/10;  d4=((adc_value%1000)%100)%10;
                   
void main()
{
 ADCON1=0b10000010;
 TRISA=0XFF;
 Lcd_Init();
 lcd_cmd(_LCD_CLEAR);
 lcd_cmd(_LCD_CURSOR_OFF);
 Lcd_Out(1,2,"EVA  PROYECT's");
 lcd_out(2,1,"voltage:");
 for(;;){
         adc_value=ADC_Read(0);
         adc_value=adc_value*5000/1023;
         calcV
         printV
         delay_ms(20);
        }
}

i am working same project
give me simulation of this project

SCHEMATIC (esquemático):
http://www.fileden.com/files/2008/9/15/ ... EMATIC.bmp
i am engineer from microsolution my website is
https://projectiot123.com

Post Reply

Return to “mikroC PRO for PIC General”