|
没用过ATMEGA329P,用ATMEL16\32,用它的库来读写EEPROM,这是用AVR编译器的) T+ e* \9 X1 @ g- b7 O
#include <avr/eeprom.h>2 K! M z {: o4 B/ Z }
void EEPROM_WRITE(unsigned char eep_address,unsigned char wr_number,unsigned char* p_header)
* U$ D) e7 I: V8 K% a{ 0 \3 i5 H0 E- e) k, k' g
eeprom_busy_wait();- S7 K7 q# Y% j' I3 [) m1 s% {+ j
eeprom_write_block (p_header,eep_address, wr_number);
) C: [8 r, h' {) E+ N}4 L; F5 R" p* B' a. A+ s, w) q
+ k+ }4 A! z) ~" L ivoid EEPROM_READ(unsigned char eep_address,unsigned char rd_number,unsigned char * p_header)
Q/ `# N! [* K7 J6 W6 @{
. p5 l7 a# b6 m, f) |8 i) u eeprom_busy_wait();5 U( P* u2 D7 ~: d* O8 q- { o
eeprom_read_block (p_header,eep_address,rd_number);/ h5 n, ?8 S0 {
}) K' F, m7 ?' O$ z6 [
|
|