#include <16f877A.h>
#device adc=10
#fuses hs,nowdt,noput
#use delay(clock=20m)
#define LCD_ENABLE_PIN PIN_D2
#define LCD_RS_PIN PIN_DO
#define LCD_RS_PIN PIN_D1
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
#include <lcd.c>
int tem;
void main()
{
int co;
set_tris_d(0);
lcd_init();
delay ms(10);
setup_adc(adc_clock_internal);//THOI GIAN LAY MAU BANG XUNG CLOCK
set_up_adc_ports(ra0_ra1_ra3analog);//RA0,RA1 TIN HIEU ANALOG ,RA3 DIEN AP THAM CHIEU
setup_acd_chanel(0);//CHON CHAN DE DOC VAO GIA TRI ANALOG BANG LENH READ_ADC
while(co==0)// KIEM TRA XEM ADC DA XU LY XONG CHUA NEU XONG THOAT KHOI VONG LAP
{
co=ADC_done();
}
tem=read_adc();
tem=tem/2.048;
tt=tem;
lcd_gotoxy(1,1);
printf(tem);
lcd_putc(0b11011111);
}
#device adc=10
#fuses hs,nowdt,noput
#use delay(clock=20m)
#define LCD_ENABLE_PIN PIN_D2
#define LCD_RS_PIN PIN_DO
#define LCD_RS_PIN PIN_D1
#define LCD_DATA4 PIN_D4
#define LCD_DATA5 PIN_D5
#define LCD_DATA6 PIN_D6
#define LCD_DATA7 PIN_D7
#include <lcd.c>
int tem;
void main()
{
int co;
set_tris_d(0);
lcd_init();
delay ms(10);
setup_adc(adc_clock_internal);//THOI GIAN LAY MAU BANG XUNG CLOCK
set_up_adc_ports(ra0_ra1_ra3analog);//RA0,RA1 TIN HIEU ANALOG ,RA3 DIEN AP THAM CHIEU
setup_acd_chanel(0);//CHON CHAN DE DOC VAO GIA TRI ANALOG BANG LENH READ_ADC
while(co==0)// KIEM TRA XEM ADC DA XU LY XONG CHUA NEU XONG THOAT KHOI VONG LAP
{
co=ADC_done();
}
tem=read_adc();
tem=tem/2.048;
tt=tem;
lcd_gotoxy(1,1);
printf(tem);
lcd_putc(0b11011111);
}