Zdravim, chtel bych se zeptat do ktere pameti a jakym zpusobem muzu ulozit napr pole znaku do pameti, tak aby byly uloženy i pri pristim zapnuti.
Nejlepe by byl nejaky maly priklad....
,,, diky ,,,
Fórum › Mikrokontroléry
ATMEGA16 paměť

Aby si nemusel pouzivat gooooogle :smile3:
#define F_CPU 8000000UL
#include <avr/io.h>
#include <avr/eeprom.h>
#include <util/delay.h>
#include "lcd.h"
uint16_t EEMEM eepromword=1500;
unsigned int servo;
int main(void)
{
uint16_t RAMword;
for (;;)
{
RAMword = eeprom_read_word(&eepromword);
servo=25;
eeprom_write_word(&eepromword,servo);
}
nepises jestli budes ukladat za behu programu nebo to tam bude natvrdo
v tom pripade muzes pouzit konstatnu const
const char znaky[] = {'z','n','a','k','y'};
je to to same jako bys pouzil pgmspace.h
a pred nazev promenne pouzil tag PROGMEM
To xhans69 :
Potrebuji ukladat za behu.... za behu si naplnim strukturu profil (obsahuje: nazev, parametr 1, parametr2) a tu bych pak chtel prekopirovat do pameti EEPROM napr pod nazvem "profil 1" az "profil 5" . Takove profily potrebuji uchovat a treba zavolat pri pristim zapnuti zarizeni....
To frontm4n : tak v tom pripade jak ti odpovedel DragonSoul
pouzijes eeprom.h a pak funkci hodnota=eeprom_read_byte(adresa v eepprom) pro cteni
a pro zapis eeprom_write_byte(adresa,hodnota)
pokud potrebujes zapsat int16, pak misto byte pises word, tedy eeprom_read_word(adresa v eeprom)
jeste se da pouzit eeprom_read/write_block viz eeprom.h
S M16 mas k dispozici 512B eeprom.
Pokud ti nebude stacit 512B budes muset pouzit externi eeprom. Ale to uz bude jina kapitola (I2C, SPI)

Přidej příspěvek
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
































Uživatelé prohlížející si toto vlákno
Podobná vlákna
Atmega16 uart — založil jur3c
ATmega16 UART — založil Pelda
ATmega16 & AD7688 — založil Lotus
ATMEGA16-nastaveni — založil frontm4n
Atmega16---sfh5110-38 — založil jur3c
Moderátoři diskuze