Okay, so Technologic states several times in the literature for the ADC24 board
that it has a 1Msps sample rate. However, in my experience so far just
sampling the minimum four channels, the absolute best I seem to be able to do
is 100ksps before the buffer overflows and the ADC stops.
Here is a code snippet:
adc = (ADC_Data_Type *)mmap(0, getpagesize(), PROT_READ|PROT_WRITE, MAP_SHARED,
fd, IO_BASE);
adc += (ADC_OFFSET)/sizeof(ADC_Data_Type);
adc_channel_address = adc + 0x4; // For slightly faster access to the
channel register
adc_data_address = adc + 0x5; // For slightly faster access to the
sample data
ADC(2) = 0; // Reset the ADC
configuration = configuration | diff_mode;
if (diff_mode == kDiff_Mode_Single_Ended)
configuration = configuration | kDiff_Mode_Single_Ended_8bit;
configuration = configuration | input_range;
configuration = configuration | ((num_channel_blocks-1) << 1);
num_channels = num_channel_blocks * 4;
ADC(2) = configuration | 1;
The main loop is here:
do {
current_channel = ((*(adc_channel_address)) >> 1) & 0x1f;
sample_data = (*(adc_data_address));
} while (current_channel != 0);
adcValue = (sample_data & 0x07ff) + (!(sample_data & 0x800)*0x800);
If I do nothing else but the above do/while and adcValue lines, 100ksps is
about the maximum. If I'm running other threads that slows way down. So why
can I never get 1Msps?
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ts-7000/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/ts-7000/join
(Yahoo! ID required)
<*> To change settings via email:
<*> To unsubscribe from this group, send an email to:
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
|