I know, that I'm working rigt now with a prescaler of 128. In the future, I will reduce this value to get more velocity.
I'm triyng to reach the maximum reading rate for an accelerometer with this arduino board, knowing that the maxmum should be 200kHz, to ensure reading accuracy.
The resulting value is now always and forever "Data: 1023", what I do like more, buy I can't change it, putting different voltages. I suspect that the problem is a problen with the instructions order...
I will read the datasheet again.
I don't think you need to setup all the ADC stuff continually in loop() so moving some of it to setup may help.
I think you should use interrupts to ensure the ADC has finished though 3ms should be enough.
I wrote some code a while back for reading a CCD array and managed to get ADC read time down to about 18us by just altering the ADC prescale to 16. There would be a little more overhead to store the result but but maybe that would be fast enough, else you could alter the prescale even more.
// set ADC prescale to 16 to speed it up analogRead()
sbi(ADCSRA,ADPS2) ;
cbi(ADCSRA,ADPS1) ;
cbi(ADCSRA,ADPS0) ;
I'm triyng to reach the maximum reading rate for an accelerometer with this arduino board, knowing that the maxmum should be 200kHz, to ensure reading accuracy.
The data sheet claims 89k conversions/sec and that's for 8 bit conversions and and free running mode - There's no way to get 200k conversions/sec out of any of these chips.
Don't use delay wait on conversion complete in stead (look in analogRead()) Some of the ode you have in loop() should be in setup.
assembly
Assembler is often slower than code written in c/c++ The compiler is far better than you at producing "optimal code"
but it's not changing the result of the output value
You need to change the value of the input voltage to get a change in reading.
Try testing it by just connecting the input pin to a pot.
Anyway as others have pointed out you are going about it all wrong. If you want to do it in machine code you have to loop until the end of conversion flag is set, then you can read the results. Do not use delay at all.