atmega parameter tarolas?

Leto Tokarev leto at irisz.hu
Thu Jun 17 11:54:15 CEST 2004


> ATMega 8 belsõ eepromja nem jó?
> Az ingyért van:)Gyarilag benne...

De, csak nem realizaltam, hogy van benne ilyen!:)
Koszonom mindenkinek a segitseget, mukodik.

Itt egy c peldaprogram, a hozzam hasonloan assembler kihivasokkal
kuszkodoknek:




Leto
--


There are 4 functions for accessing the EEPROM, which are declared in
eeprom.h:

 /* read one byte from EEPROM address ADDR */
 extern unsigned char eeprom_rb(unsigned int addr);
 
 /* read one 16-bit word (little endian) from EEPROM address ADDR
 */
 extern unsigned int eeprom_rw(unsigned int addr);
 
 /* write a byte VAL to EEPROM address ADDR */
 extern void eeprom_wb(unsigned int addr, unsigned char val);
 
 /* read a block of SIZE bytes from EEPROM address ADDR to BUF */
 extern void eeprom_read_block(void *buf, unsigned int addr,
 size_t n);
 

The following example writes the Text "Hello EEPROM!" to the beginning of
the EEPROM.

 #include <eeprom.h>
 
 void main(void)
 {
   int i=0;
   char string[] = "Hello EEPROM!"; 
 
   while(string[i]!=0) {       //end of string?
     eeprom_wb(i, string[i]);  //write one byte
     i++;                      //increment i by 1
   }
 
   for(;;); //loop
 
 }
 




More information about the Elektro mailing list