0

I'm trying to write numbers 0-9 to the EEPROM memory using assembly language in AtmelStudio 7. I made a loop until the counter reaches 8 (which is stored in R17 and a counter which is stored in R16). EEPROM in ATmega16 is 512 bytes so I will need two registers(Low and High bytes) to point to that memory. everything is working fine except that i cant find a way to track EEPROM memory to check if the data is being written or not. Hope someone gives me a hint with AtmelStudio 7. Here is my code:

; Replace with your application code
start:
/* Define a counter in R16 */
ldi R16,0
ldi R17,8
/* EEPROM Address to be written */
ldi R18,0x00
ldi R19,0x00
/* Loop through this untill 9 numbers are written */
EEPROM_WRITE:
/* Wait untill the EEWE gets 0 */
/* Skip next instruction if EEWE is clear in EECR */
sbic EECR,EEWE
rjmp EEPROM_WRITE   
/* Write the address to be filled with the number :D */
out EEARL,R18
out EEARH,R19   
/* Write the data */
/* Counter can be used itself */
out EEDR,R16
/* Write logical one to the EEMWE */
/* Set bit immediate */
sbi EECR,EEMWE
/* Start write */
sbi EECR,EEWE
/* Add 1 to the counter */
inc R16
/* Go to the next address on EEPROM */
inc R18
/* Check the loop end point */
cp R16,R17
brne EEPROM_WRITE
rjmp EEPROM_WRITE
rjmp start
hexpheus
  • 741
  • 10
  • 22
  • Reading from EEPROM works just like writing except you set EERE and then read EEDR. Alternatively you can read the EEPROM externally from the chip by using the parallel, SPI or JTAG interfaces. – Ross Ridge Mar 17 '17 at 07:59

1 Answers1

0

If you want to track EEPROM in atmel studio, than you need to start debug session and open memory window (Alt+6). There should be drop down list where should be eepom option. You can verify your data there.

nopasara
  • 538
  • 3
  • 10