//testing LCD display HD44780//
#include <16f877a.h>
#device adc=10
#fuses xt,nolvp,noprotect,nowdt,noput
#include <math.h>
#use delay(clock=4Mhz)
//////////////////////
#include <LCD.c>//da lo mismo mayusc - minsc
/////////////////////
void main() {
float temp=0;
int16 aux;
//set_tris_c(0x02);
setup_adc_ports( AN0_AN1_AN3 );
setup_adc(adc_clock_internal);
lcd_init();
while (TRUE) {
for(;;){//while (!input(pin_c1))
set_adc_channel(3);
delay_ms(20);
disable_interrupts(GLOBAL);
aux=read_adc();
temp=5.0*aux/1023.0;
lcd_putc('\f');
lcd_gotoxy(1,1);
printf(lcd_putc,"adc=%4ld",aux);
lcd_gotoxy(1,2);
printf(lcd_putc,"decimal=%01.3fv",temp);
delay_ms(100);
}
}
}
评论0