View Single Post
Old 21-05-2013, 12:35 AM   #2
tuonghiendk7.1
Đệ tử 1 túi
 
Tham gia ngày: Aug 2011
Bài gửi: 13
:
Send a message via Yahoo to tuonghiendk7.1
int16 value;
void main()
{
set_tris_a(0xff);

ENABLE_INTERRUPTS(GLOBAL);
setup_adc_ports(ALL_ANALOG); hoặc setup_adc_ports(an0);
setup_ADC(ADC_CLOCK_DIV_32);//tùy bạn
set_adc_channel(0);

while(1)
{
int t;
delay_ms(500); // mình nghĩ ko cần
value=read_adc();

Đây là một số thứ theo mình biết bạn dùng ADC 10 bit bạn khai báo value ở chế độ int16 thì hợp lý hơn.
tuonghiendk7.1 vẫn chưa có mặt trong diễn đàn   Trả Lời Với Trích Dẫn