Ðề tài: Hỏi về ADC 10 bit
View Single Post
Old 25-09-2009, 01:45 AM   #7
phuong_dtk4s
Nhập môn đệ tử
 
Tham gia ngày: Apr 2009
Bài gửi: 2
:
adc cua 18f4431

các anh cho em hỏi một chút,đoan code cua em viet như sau:
#include <18f4431.h>
#device *=16 adc=8
#use delay(clock=20000000)
#fuses hs,nowdt
#include <lcd.c>
#use fast_io(b)
#use fast_io(d)
#byte portd=0xf83
int8 x;
void main()
{//set_tris_a(0xff);
//set_tris_b(0x00);
set_tris_d(0x00);
setup_adc(ADC_CLOCK_INTERNAL );
setup_adc(san1|vss_vdd);
set_adc_channel(1);
delay_ms(10);
while(1)
{
x=read_adc();
if (x>=100)
{ portd=1;
delay_ms(200);
portd=0;
delay_ms(200);
}
}
}
////////////////////////////////////////////////////////////////////
sao trong protuers của em mô phỏng toan báo lỗi sau:
porta <1> is not configured as a analog input
em không hieu sao lại bị lối vậy nữa, các anh có thể giải thich giúp em được không ạ
phuong_dtk4s vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn