2016-09-23 03:26 AM
APB2 clock
: 100Mhz ADC clock: 100/4=25Mhz Data resolution: 12bit One conversion time = 15/25 = 0.6us, 6 conversion is 3.6us But in real environment when i test on device i got the result: 6 conversations = 1.8us What does the problem i get? Please help me! My program #define C_NUM (10000) main(){ T_ADC_REQ_SEQ_SET pk_adc_seq_set; UH vals[6]; UW c,t0,t1; double ta,tb; pk_adc_ini.align = 0; pk_adc_ini.res = 0; ercd = ini_adc(); pk_adc_seq_set.scn_num = 6; pk_adc_seq_set.scn_seq[0]=8; pk_adc_seq_set.scn_seq[1]=7; pk_adc_seq_set.scn_seq[2]=6; pk_adc_seq_set.scn_seq[3]=10; pk_adc_seq_set.scn_seq[4]=0; pk_adc_seq_set.scn_seq[5]=3; ctl_adc(ADC_REQ_SEQ_SET,&pk_adc_seq_set); ercd = ctl_adc(ADC_REQ_STA,); for(;;){ c = C_NUM; t0 = get_time(); while (c) { gets_adc(ch, vals); c--; } t1 = get_time(); ta = ((double) (t1 - t0) / (double) C_NUM); c = C_NUM; t0 = get_time(); while (c) { c--; } t1 = get_time(); tb = ((double) (t1 - t0) / (double) C_NUM); printf(''%f\n'',(double)( ta - tb)); } }