#include<16f88.h>
#device adc =10
#use delay (clock=4M)
#fuses XT,NOWDT
#include <lcd.c>
float a,b,c,d,e,f;
float cursor,toper,topbr,calculo,resultado;
float cero,bandabr,bandaer;
}
void main()
{
setup_adc_ports(sAN0|sAN1|sAN2|sAN3|VSS_VDD);// habilitacion de canales adc >
setup_adc(ADC_CLOCK_DIV_2);
lcd_init();
while(1){
//*********************************************************
set_adc_channel(0); //habilitacion canal 0
delay_us(20);
cursor= read_adc(); //lectura canal 0 a variable cursor
//**********************************************************
set_adc_channel(1);
delay_us(20);
topbr =read_adc();
bandabr=(topbr-cero)/7;
//*********************************************
set_adc_channel(2);
delay_us(20);
toper=read_adc();
bandaer=(cero-toper)/7;
a=bandaer*2; // esto mismo tendria que repetirlo en el canal 1
b=bandaer*3; // donde tendria que hacer todas estas cuentas
c=bandaer*4;
d=bandaer*5;
e=bandaer*6;
f=bandaer*7;
//*********************************************
set_adc_channel(3);
delay_us(20);
cero=read_adc();
//*****************************************************************
if(cursor==toper)
{
output_high(PIN_a3);//led************************
lcd_gotoxy(1,1);
printf(lcd_putc
," 35\337er top"); lcd_gotoxy(1,2);
printf(lcd_putc
," |>>>>>>>>");
}
if (cursor==a)
{
lcd_gotoxy(1,1);
printf(lcd_putc
," 30\337er "); lcd_gotoxy(1,2);
printf(lcd_putc
," |>>>>>>> ");
}
if(cursor==b)
{
lcd_gotoxy(1,1);
lcd_gotoxy(1,2);
}
if (cursor==c)
{
lcd_gotoxy(1,1);
lcd_gotoxy(1,2);
}
if (cursor==d)
{
lcd_gotoxy(1,1);
lcd_gotoxy(1,2);
}
if (cursor==e)
{
lcd_gotoxy(1,1);
lcd_gotoxy(1,2);
}
if(cursor==f)
{
lcd_gotoxy(1,1);
lcd_gotoxy(1,2);
}
if (cursor==cero) // compara cursor con el valor del prest que regula el 0 (canal an_3)
{
lcd_gotoxy(1,1);
lcd_gotoxy(1,2);
}
if (cursor==topbr) // de aca para abajo seria lo mismo
{
lcd_gotoxy(1,1);
printf(lcd_putc
,"top 35\337br "); lcd_gotoxy(1,2);
}
}
}