|
没用过ATMEGA329P,用ATMEL16\32,用它的库来读写EEPROM,这是用AVR编译器的
/ k2 T! J3 K9 L2 D5 U; o( Q#include <avr/eeprom.h>5 P) `! W! m; m* t8 I
void EEPROM_WRITE(unsigned char eep_address,unsigned char wr_number,unsigned char* p_header)
4 m4 x& ]- C) s{
G0 b% A5 G( a% g% H1 p, R& z eeprom_busy_wait();, e& Y/ w6 f% V1 v" m
eeprom_write_block (p_header,eep_address, wr_number);9 d1 ?* |) C% ^4 {' K" l! c1 m) |& X
}
. E+ c- \( W. n7 v
3 [! g b) {) |2 }( L+ M+ C2 K# `& Svoid EEPROM_READ(unsigned char eep_address,unsigned char rd_number,unsigned char * p_header)' [% R& L8 |) O3 N
{
g. N& n2 K# ] eeprom_busy_wait();
; o7 d$ O6 a# }1 F% `( f. b eeprom_read_block (p_header,eep_address,rd_number);
3 Z: O" p! b/ v}* O8 p: e0 l1 p
|
|