메뉴 바로가기

서브메뉴 바로가기

본문 바로가기

logo

묻고 답하기
러빙유2008.01.09 12:13

그런데요. 제가 궁금한게 있는데요..저같은 경우에는 OperatingADC(); 하면 ADC 를 해가지고 오는데, 약간의 딜레이가 있습니다.

왜냐하면, 제가 사용하고 있는 16-BIT ADC 같은 경우에는 한번 읽어 올때마다 calibration을 하는 것이 정형화 되어 있어

calibration 딜레이가 있어 값을 읽어오는 데 약간의 딜레이를 주고 있습니다. 이렇게 되면, fnd, LED 업데이트에 영향이

있어요..

참고로 ad7705.c 를 첨부합니다.

-ad7705.c-----------

/ad7705 초기화 루틴 while문 이전에 선언initailaization routine
void adc_init()
{       //hw reset
        SETBIT(PORTE,5); //Reset ad7705A, B
        delay_ms(1);
 CLEARBIT(PORTE,5);//Set high
 //interface reset
 //Init Clock register
 write_adc_byte_A( 0x20 );//Communications Register set to write of clock register
 write_adc_byte_A( 0x04 );//Clock Register info here
 write_adc_byte_A( 0x21 );//Communications Register set to write of clock register
 write_adc_byte_A( 0x04 );//Clock Register info here
 write_adc_byte_B( 0x20 );//Communications Register set to write of clock register
 write_adc_byte_B( 0x04 );//Clock Register info here
 //Init Setup register
 setup_adc_device_A_ch1();
 setup_adc_device_A_ch2();
 setup_adc_device_B();
        delay_ms(2000);
}

//while문안에서 계속 호출하게 될 함수 <---딜레이 필요함.
unsigned int read_adc_value_A(unsigned int ch)

   unsigned int value;
     
   if(ch==1){
      setup_adc_device_A_ch1();
      delay_ms(2000);
      write_adc_byte_A(0x38);//communications register set to read of data register of channel 1
      delay_ms(2000); }
   else {
      setup_adc_device_A_ch2();
      delay_ms(2000);
      write_adc_byte_A(0x39);//communications register set to read of data register of channel 2
      delay_ms(2000); }
     
   value=read_adc_word_A();
  
   return (value);
}
 

사진 및 파일 첨부

여기에 파일을 끌어 놓거나 왼쪽의 버튼을 클릭하세요.

파일 용량 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )