number of machine cycles used to store a data in memory.

hello all!!

i want to know how many machine cycles used to store a data in memory(Stack and EEPROM) ??

thank you.

you can use objdump.exe to see the assembly output. It is part of the toolchain.

Thank you Rob Tillaart.!!

currently i am running below example code.

#include <EEPROM.h>

// the current address in the EEPROM (i.e. which byte
// we're going to write to next)
int addr = 0;
int val = 0;
void setup()
{
}

void loop()
{

  EEPROM.write(addr, val);

  val ++;
  addr = addr + 1;
  if (addr == 512){
    addr = 0;
    val = 0;
  }
  delay(100);
}

objdump commad is:

C:\Users\bijendra\AppData\Local\Temp\build6162742129533870816.tmp>C:\Users\bijendra
h\Downloads\arduino-1.0.5-windows\arduino-1.0.5\hardware\tools\avr\bin\avr-objdu
mp.exe -D -S eeprom_write.cpp.elf > bijendra3.txt

i got a Disassembly output of EEPROM write is

static inline void eeprom_write_byte (uint8_t *__p, uint8_t __value)
{
do {} while (!eeprom_is_ready ());
104: f9 99 sbic 0x1f, 1 ; 31
106: fe cf rjmp .-4 ; 0x104 <_ZN11EEPROMClass5writeEih>

#if defined(EEPM0) && defined(EEPM1)
EECR = 0; /* Set programming mode: erase and write. */
108: 1f ba out 0x1f, r1 ; 31
#endif

#if E2END <= 0xFF
EEARL = (unsigned)__p;
#else
EEAR = (unsigned)__p;
10a: 72 bd out 0x22, r23 ; 34
10c: 61 bd out 0x21, r22 ; 33
#endif
EEDR = __value;
10e: 40 bd out 0x20, r20 ; 32
: [__eecr] "i" (_SFR_IO_ADDR(EECR)),
[__sreg] "i" (_SFR_IO_ADDR(SREG)),
[__eemwe] "i" (EEMWE),
[__eewe] "i" (EEWE)
: "r0"
);
110: 0f b6 in r0, 0x3f ; 63
112: f8 94 cli
114: fa 9a sbi 0x1f, 2 ; 31
116: f9 9a sbi 0x1f, 1 ; 31
118: 0f be out 0x3f, r0 ; 63

so the total number of cycles consumed(command written in blue color) is

1+1+1+1+2+2+1

am i right or i am making any mistake??