//DEFINICION PINES LCD
sbit LCD_RS at RC3_bit;
sbit LCD_EN at RC5_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D4 at RD4_bit;
//DFINICION TRIS LCD
sbit LCD_RS_Direction at TRISC3_bit;
sbit LCD_EN_Direction at TRISC5_bit;
sbit LCD_D7_Direction at TRISD7_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D4_Direction at TRISD4_bit;
void main()
{
//DEFINICION VARIABLES
unsigned int adc_value1;
unsigned int adc_value2;
signed int adc_value3;
signed int adc_value4;
unsigned int adc_value5;
unsigned int adc_value6,x,z;
char texto1[16];
char texto2[16];
char texto3[16];
char texto4[16];
char texto5[16];
char texto6[16];
float Mv1;
float Mv2;
float Mv3;
float Mv4;
float Mv5;
float Mv6;
TRISA=0XFF;
PORTA=0X00;
Lcd_Init();
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,2,"INVERSOR DC/AC");
Lcd_Out(2,4,"1500 WATT");
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
Lcd_Out(1,3,"INICIANDO...");
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
while(1)
{
adc_value1=ADC_read(0);//TEMPERATURA 1°
Mv1 = adc_value1*0.488;
FloatToStr(Mv1,texto1);
Lcd_out(1,10,texto1);
Lcd_Out(1,1,"T.IGBT1:");
Lcd_Chr(1,15,223);
Lcd_Chr(1,16, 'C');
adc_value2=ADC_read(1);//TEMPERATURA 2°
Mv2 = adc_value2*0.488;
FloatToStr(Mv2,texto2);
Lcd_out(2,10,texto2);
Lcd_Out(2,1,"T.IGBT2:");
Lcd_Chr(2,15,223);
Lcd_Chr(2,16, 'C');
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
adc_value3=ADC_read(2);//CORRIENTE BATERIA
Mv3 =(adc_value3-512)*0.0586;
FloatToStr(Mv3,texto3);
Lcd_Out(1,7,texto3);
Lcd_Out(1,1,"I.DC:");
Lcd_Out(1,14,"AMP ");
adc_value4=ADC_read(3);//CORRIENTE SALIDA INVERSOR
Mv4 =(adc_value4-512)*0.0586;
FloatToStr(Mv4,texto4);
Lcd_out(2,7,texto4);
Lcd_Out(2,1,"I.AC:");
Lcd_Out(2,14, "AMP");
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
adc_value5=ADC_read(4);//VOLATAJE BATERIA
Mv5 =(adc_value5*49)/1024.0;
FloatToStr(Mv5,texto5);
Lcd_Out(1,7,texto5);
Lcd_Out(1,1,"V.DC:");
Lcd_Out(1,13, "VOLTS");
adc_value6=ADC_read(5);//VOLTAJE SALIDA INVERSOR
Mv6 =(adc_value6*462)/1024.0;
FloatToStr(Mv6,texto6);
Lcd_Out(2,7,texto6);
Lcd_Out(2,1,"V.AC:");
Lcd_Out(2,13, "VOLTS");
Delay_ms(2000);
Lcd_Cmd(_LCD_CLEAR);
}
}