# Int storage time

Hello, I would like to ask of anyone is familiar with the procedure carried out by the arduino when saving an int, as I need to calculate (to compare with measurements) how long this takes. As an example, the analogread procedure should take the processor speed, divide by 128 from a prescaler and divide by 13 cycles, coming out at around 9.6khz.

While running some tests on analogread and storing the values into variables, I reached a value of 107mS with a really high certainty, coming out at 8.9kHz, and I want to know if the frequency difference comes from having stored the values or not.

Is anyone familiar with the int storage procedure? Is this more appropriate on a different section of the forums?

ed_p:
I reached a value of 107mS with a really high certainty, coming out at 8.9kHz

I have a really high certainty that there is a few orders of magnitude difference between those two values. I suggest you recheck your math before venturing any further down that rabbit hole.

Storing an integer to a (micro)SD memory ? Or to EEPROM ? Or just into a variable in sram ?
You can ignore the time that it takes to store an integer in ram, because that is very fast and the compiler might decide to not store it at all, and keep it in a register.

The ATmega328P is optimized for a high sample rate, but the Arduino functions don't use that. With a timer, an interrupts, and a analog input, it is possible to have a higher sampling rate.
The problem with high sample rates is that all that data has to go somewhere.

Are you trying to make some kind of oscilloscope ? That has been done by many others.

Im trying to have a high accuracy in the sampling time value for using Z transform to design digital filters. Im using standard arduino operations, e.g. int value = analogread, and others like that. My measurement also matches up with the stickied benchmark value, 112mS, so there is something going on taking up clock cycles consistently. If not the analogread or int storage, what could it be?