Skip to main content
Arduino

Timeline for How fast can I read Arduino port D?

Current License: CC BY-SA 4.0

9 events
when toggle format what by license comment
Jul 27, 2018 at 9:02 comment added Edgar Bonet According to the instruction set manual, it's 2 cycles, except on XMEGA and on "reduced core" ATtinies. My understanding is that "reduced core" refers to the AVR core that lacks registers r0 through r15, i.e. the last line in this table. Most ATtinies, including the ones Arduino programmers are most likely to come across (e.g. ATtiny 85), are not "reduced core".
Jul 27, 2018 at 8:34 comment added Tom Carpenter @EdgarBonet so it is. Only 1 cycle on ATTiny devices though :). I was using this but they have since updated it with a few corrections.
Jul 27, 2018 at 8:33 history edited Tom Carpenter CC BY-SA 4.0
added 2 characters in body
Jul 27, 2018 at 8:21 comment added Edgar Bonet st X+, r24 takes two cycles, so that's 3 cycles for every read.
Nov 11, 2016 at 0:08 history migrated from electronics.stackexchange.com (revisions)
Nov 10, 2016 at 16:33 comment added Paul Uszak Yeh, I too was wondering about the array indexing. I thought that it might take more processing. One odd thing is that the readings change with the value of the pull up resistor. With a higher value you get more "0" in the results for the same signal. Probably one of those inductance things which probably becomes apparent when reading at 8 MHz. This is probably getting a bit fast for the general plug it in and hope Arduino style of design. 500 Ohms gives an evenish number of 1s and 0s.
Nov 10, 2016 at 14:29 comment added Tom Carpenter @Neil_UK GCC is quite clever when it wants to be. It will work out that each of the writes corresponds to a series of incrementing addresses and convert it into ST X+ instructions. If you leave a gap, say miss buffer[10], it will probably keep the same optimisation but add an additional ADIW X,1 in the gap rather than recalculating the address.
Nov 10, 2016 at 14:10 comment added Neil_UK I'm surprised that a succession of buffer[const] = ... assembles to ST X+, I would have expected I'd need to use buffer[var++] = ... . I just ask as I'm going to want to do similar 'fast' things myself shortly
Nov 10, 2016 at 13:49 history answered Tom Carpenter CC BY-SA 3.0

AltStyle によって変換されたページ (->オリジナル) /