Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 在汇编中的ATmega16 EEPROM存储器上写入一些数字_Assembly_Avr_Atmega16 - Fatal编程技术网

Assembly 在汇编中的ATmega16 EEPROM存储器上写入一些数字

Assembly 在汇编中的ATmega16 EEPROM存储器上写入一些数字,assembly,avr,atmega16,Assembly,Avr,Atmega16,我正在尝试使用ATMELStudio7中的汇编语言将数字0-9写入EEPROM内存。我做了一个循环,直到计数器达到8(它存储在R17中,计数器存储在R16中)。ATmega16中的EEPROM是512字节,所以我需要两个寄存器(低字节和高字节)来指向该内存。 一切都很好,除了我找不到一种方法来跟踪EEPROM内存,以检查数据是否正在写入。希望有人能给我一个提示。 这是我的密码: ; Replace with your application code start: /* Define a cou

我正在尝试使用ATMELStudio7中的汇编语言将数字0-9写入EEPROM内存。我做了一个循环,直到计数器达到8(它存储在R17中,计数器存储在R16中)。ATmega16中的EEPROM是512字节,所以我需要两个寄存器(低字节和高字节)来指向该内存。 一切都很好,除了我找不到一种方法来跟踪EEPROM内存,以检查数据是否正在写入。希望有人能给我一个提示。 这是我的密码:

; 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

若要在atmel studio中跟踪EEPROM,则需要启动调试会话并打开内存窗口(Alt+6)。应该有下拉列表,其中应该有eepom选项。您可以在那里验证您的数据。

从EEPROM读取数据的工作原理与写入数据的工作原理相同,只是您先设置EERE,然后读取EEDR。或者,您可以使用并行、SPI或JTAG接口从芯片外部读取EEPROM。