|
没用过ATMEGA329P,用ATMEL16\32,用它的库来读写EEPROM,这是用AVR编译器的; d2 ?& Q; M' c5 o
#include <avr/eeprom.h>9 p. F1 M/ j6 ^- z& J* ] q; n
void EEPROM_WRITE(unsigned char eep_address,unsigned char wr_number,unsigned char* p_header)
" w1 v* M9 k. J6 a8 M ?) g ]4 T% A$ i" [{ 3 W9 ^8 ^3 {2 J1 y4 t
eeprom_busy_wait(); N: P4 a+ j! S& ^0 V2 o& _* u! h
eeprom_write_block (p_header,eep_address, wr_number);3 G0 G# `* ^) B( W9 E$ }9 g
}( F$ o! Z5 f( N
1 i& }0 V* |0 Kvoid EEPROM_READ(unsigned char eep_address,unsigned char rd_number,unsigned char * p_header)4 i% [9 J, n# I1 \+ W
{8 p% z3 u8 n0 Y5 X7 O1 H* v: o7 d
eeprom_busy_wait();
. f* c" b1 A {9 t eeprom_read_block (p_header,eep_address,rd_number);
, p, C& ~8 V t* o' U/ F}
) Y: S0 x( N3 \# \. e' p5 x" X |
|