在不同的内存地址存储 table - C for AVR XMEGA256A3BU
Storing table at different memory address - C for AVR XMEGA256A3BU
我想弄清楚如何将华氏温度 table 存储到内存地址 0x20 而不是默认的 0x0000。我尝试了几条路线,但到目前为止,没有任何效果。代码在C.
#include <avr/io.h>
#include <avr/eeprom.h>
int main(void)
{
uint8_t fahrenheit[20] =
{32,34,36,37,39,41,43,45,46,48,50,52,54,55,57,59,61,63,64,66};
for(int i = 0; i < 20; i++)
{
eeprom_write_byte((uint8_t *)i, fahrenheit[i]);
}
}
eeprom_write_byte((uint8_t *)i, fahrenheit[i]);
将值写入地址 i
。因此,想写从0x0020开始的值,就这样eeprom_write_byte((uint8_t *)i+20, fahrenheit[i]);
我想弄清楚如何将华氏温度 table 存储到内存地址 0x20 而不是默认的 0x0000。我尝试了几条路线,但到目前为止,没有任何效果。代码在C.
#include <avr/io.h>
#include <avr/eeprom.h>
int main(void)
{
uint8_t fahrenheit[20] =
{32,34,36,37,39,41,43,45,46,48,50,52,54,55,57,59,61,63,64,66};
for(int i = 0; i < 20; i++)
{
eeprom_write_byte((uint8_t *)i, fahrenheit[i]);
}
}
eeprom_write_byte((uint8_t *)i, fahrenheit[i]);
将值写入地址 i
。因此,想写从0x0020开始的值,就这样eeprom_write_byte((uint8_t *)i+20, fahrenheit[i]);