For (int I = 0;I < 100;I++) {
Adc_init (GP_ADC_SE, GP_ADC_SIGN, 0);
Adc_enable_channel (3);
Adc_sample4 [I] = adc_get_sample ();
Adc_disable ();
Adc_init (GP_ADC_SE, GP_ADC_SIGN, 0);
Adc_enable_channel (0);
Adc_sample1 [I] = adc_get_sample ();
Adc_disable ();
Adc_init (GP_ADC_SE, GP_ADC_SIGN, 0);
Adc_enable_channel (2);
Adc_sample3 [I] = adc_get_sample ();
Adc_disable ();
Adc_init (GP_ADC_SE, GP_ADC_SIGN, 0);
Adc_enable_channel (1);
Adc_sample2 [I] = adc_get_sample ();
Adc_disable ();
}
I use the adc sampling, however after 100 cycles, a total of 400 times, time has passed ms level
The Features
65 ns, 10 - bit ADC with dynamic conversion time
Keywords:
Device:
Dear CSQ,
Sorry, I 'm answering in English.
We are & into your code and will try to optimize it.
Kind regards
FvD_Dialog
So how can I use the ADC in high rate?
hello
This calculation is not precise.
In your code, sampling time should account for only a few part of code loss (for loop, function calls) and ADC initialization takes up time, much higher than the sampling time.
May I have your project needs to implement what function?Need to how fast sampling speed?
Use of adc acquisition for high frequency modulation signal receiving, about 1 MHZ, I mainly in the repository didn't find other serial adc sampling related library function, or the fastest can pick how much
Hi CSQ,
The theory of 3.3 Msample/s.
ADC initialization (20 us) and run after the conversion time is close to 1 us, transformation of data processing need 4 us, so the theory of maximum sampling rate is 16/5 = 3.3 Msamples/s
Actually finish the transformation in the process of data stored in ram, there will be some other code running time of the loss, so it is difficult to achieve the theoretical value.
Do you want to the ADC sampling rate can reach 1 MHZ or want to 1 MHZ waveform sampling?
Waveform sampling of 1 MHZ, at the bottom of the function
Adc_get_sample {
Int CNT = ADC_TIMEOUT;
SetBits16 (GP_ADC_CTRL_REG GP_ADC_START, 1);
While (CNT, && (GetWord16 (GP_ADC_CTRL_REG) & GP_ADC_START)!= 0 x0000);
X0000 SetWord16 (GP_ADC_CLEAR_INT_REG, 0);/ / Clear the interrupt
Return GetWord16 (GP_ADC_RESULT_REG);
}
This seemingly no continuous read mode
hello
3.3 Mhz is the sampling rate theory can achieve, in fact, because of the limitation of ram chips frequency limit (16 Mhz), and additional, the cost of processing code, may not apply"Waveform sampling of 1 MHZ"This kind of application scenarios