Discussion of issues related specifically to writing code for native mode devices. This includes ZBasic code as well as assembly language code and C code, both inline and standalone.
I would like to know the fastest way to measure ADC values with a native mode device. Secondly, would an XMega device be much faster?
I would like to measure as many ADC values as possible during a 2ms interval. I would like to eliminate any loop overhead, so something like this comes to mind:
twesthoff wrote:I would like to know the fastest way to measure ADC values with a native mode device.
The fastest method is to directly manipulate the ADC and configure it for free-running mode. In that mode, the ADC does continuous conversions and your code need only wait for the flag that indicate another conversion is complete. Provided that you can process the resulting data before the next conversion is completed, this will give the fastest series of conversions.
twesthoff wrote:Secondly, would an XMega device be much faster?
An xmega device will be faster by virtue of the fact that it runs twice as fast (or four times as fast compared to the 7.37MHz devices). However, it won't actually be two or four times the speed because the xmega has a 12-bit ADC while the mega/tiny devices have 10-bit ADC. This is because both ADCs require a fixed number of cycles per bit of resolution.