그런데요. 제가 궁금한게 있는데요..저같은 경우에는 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); }
그런데요. 제가 궁금한게 있는데요..저같은 경우에는 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);
}