Set Point

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

#include <16f887.

h>
#fuses XT, NOWDT, NOPROTECT, NOLVP
#use delay(clock = 4000000) // se escoge frecuencia oscilador interno ene este c
aso de pic a trab
#define use_portb_kbd TRUE
#use fast_io(b)
//Optimizamos E/S del PORTB
#define use_portc_lcd TRUE
#include <lcd.c> // libreria que permite controlar lcd
#include <KBD_lib.c>
#BYTE PORTA=0x05
#BYTE PORTB=0x06
#BYTE PORTC=0x07
#BYTE PORTD=0x08
#BYTE TRISA=0x85
#BYTE TRISB=0x86
#BYTE TRISC=0x87
#BYTE TRISD=0x88
#BYTE OPTION_REG=0x81
#ROM 0x2100={1}

void main(){
//char k;
int16 uni,dec,cen,aux;
int x, k;
lcd_init();
kbd_init();
option_reg=0;
lcd_putc("\fIngrese Temp...\n");
while(TRUE){
k=kbd_getc();
x=k-48;
if(k!=0){
if(k=='0','1','2','3','4','5','6','7','8','9' && k!='#' && k!='*'){
cen=dec;
dec=uni;
uni=k;
aux=(cen*100)+(dec*10)+uni;
printf(lcd_putc,"\f %ld ",cen);
printf(lcd_putc,"\f %ld ",dec);
printf(lcd_putc,"\f %ld ",uni);
delay_ms(200);
//if(aux>255){
//printf(lcd_putc,"\fIngrese Temp...");
//}
lcd_putc(k);
delay_ms(100);
}
if (k=='#' && aux!=0){
if (aux==0){
lcd_putc("\fIngrese Temp....\n");

}
write_EEPROM(1,aux);
printf(lcd_putc,"\fGuardando...");
delay_ms(200);
read_EEPROM(1);
printf(lcd_putc,"\fGuardado = %ld",aux);
delay_ms(200);
lcd_putc("\fIngrese Temp...\n");
}
if (k=='*'){
lcd_putc('\f');
lcd_putc(k);
delay_ms(100);
printf(lcd_putc,"\fBorrando...");
delay_ms(200);
lcd_putc("\fPresione tecla...\n");
}
}
}
}

You might also like