You are on page 1of 6

2016

PROYECTO: Voltímetro con dsPIC 30F4013

- Lliuyacc León Edward 1313220623


-Mora Ocrospoma Josué 1313210037
-Pardo Martínez Jordan 1313220231
-Palomo Lamas Pedro Ernesto 1313210153
LAB. DE FISICA 2
Universidad Nacional del Callao
Facultad de Ingeniería eléctrica y electrónica

VOLTIMETRO CON dsPIC


1. CIRCUITO dsPIC

1
Universidad Nacional del Callao
Facultad de Ingeniería eléctrica y electrónica

2. PROGRAMACION

// configuración de los fuses


#include <30F4013.h>
#FUSES NOWDT //No Watch Dog Timer
#FUSES HS2_PLL16 //Crystal osc <= 4mhz for PCM/PCH , 3mhz to 10 mhz for PCD
#FUSES PR_PLL //Primary Oscillator
#FUSES NOCKSFSM //Clock Switching is disabled, fail Safe clock monitor is disabled
#FUSES WPSB16 //Watch Dog Timer PreScalar B 1:16
#FUSES WPSA512 //Watch Dog Timer PreScalar A 1:512
#FUSES PUT64 //Power On Reset Timer value 64ms
#FUSES NOBROWNOUT //No brownout reset
#FUSES BORV47 //Brownout reset at 4.7V
#FUSES LPOL_HIGH //Low-Side Transistors Polarity is Active-High (PWM 0,2,4 and 6)
//PWM module low side output pins have active high output polar
#FUSES HPOL_HIGH //High-Side Transistors Polarity is Active-High (PWM 1,3,5 and 7)
//PWM module high side output pins have active high output polarity
#FUSES NOPWMPIN //PWM outputs drive active state upon Reset
#FUSES MCLR //Master Clear pin enabled
#FUSES NOPROTECT //Code not protected from reading
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOCOE //Device will reset into operational mode
#FUSES ICSP1 //ICD uses PGC1/PGD1 pins
#FUSES RESERVED //Used to set the reserved FUSE bits

#device adc=12 //ADC 12 bits


#use delay(clock=4000000)
//código
#define LCD_ENABLE_PIN PIN_F4 ////
#define LC D_RS_PIN PIN_F6 ////
#define LCD_RW_PIN PIN_F5 ////
#define LCD_DATA4 PIN_D2 ////
#define LCD_DATA5 PIN_D8 ////
#define LCD_DATA6 PIN_D1 ////
#define LCD_DATA7 PIN_D0

#include <lcd.c>

2
Universidad Nacional del Callao
Facultad de Ingeniería eléctrica y electrónica

#include <math.h>
#include <stdlib.h>
float voltage;
float Lect_adc;
void main()
{

Lect_adc=0;// valor adc


voltaje=0;

lcd_init();
setup_adc_ports (sAN2|VREF_VREF);
setup_adc(ADC_CLOCK_DIV_32|ADC_TAD_MUL_2); //especificamente configurado a 120

while(true)
{
set_adc_channel(2);
Lect_adc = read_adc();
delay_ms(20);
voltaje=((5.0*Lect_adc)/4095);
lcd_putc("\f");
lcd_gotoxy(0,1);
printf(lcd_putc,"Voltaje = %f ",voltaje);
lcd_gotoxy(0,2);
printf(lcd_putc,"ADC = %f",Lect_adc);
delay_ms(500);
}
}

3
Universidad Nacional del Callao
Facultad de Ingeniería eléctrica y electrónica

3. SIMULACION

+20V

R1
3K
LCD1
LM016L
RV2
R2 U1
+5.00

21%
1k
Volts 13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2

VDD
VSS

VEE
2 36

RW
10k

RS

D0
D1
D2
D3
D4
D5
D6
D7
RA0/AN0 RB3/PGM

E
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5

1
2
3

4
5
6

7
8
9
10
11
12
13
14
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7

PIC16F877A
4. IMPLEMENTACION

4
Universidad Nacional del Callao
Facultad de Ingeniería eléctrica y electrónica

5. MEDIDAS CON EL VOLTIMETRO