|
没用过ATMEGA329P,用ATMEL16\32,用它的库来读写EEPROM,这是用AVR编译器的' @4 n8 g" h3 A6 X8 Z+ ]
#include <avr/eeprom.h>8 `/ ^6 y( ~ A1 z. c) [
void EEPROM_WRITE(unsigned char eep_address,unsigned char wr_number,unsigned char* p_header) w( ]" E) }- r3 K+ b! ]$ T
{ ) E: H/ E1 C% J( @5 f+ | H
eeprom_busy_wait();
4 t3 a# e6 c: S eeprom_write_block (p_header,eep_address, wr_number);
& J& j" _1 p$ x}
% E' i5 s8 ?) h0 @, I; ] x
7 I9 I+ S3 K3 ]% zvoid EEPROM_READ(unsigned char eep_address,unsigned char rd_number,unsigned char * p_header)4 Q2 N- L0 R. A) P% l
{
* ]5 ~* U) P" E8 D# ~7 A eeprom_busy_wait();
3 Z: U4 G& H. L; m% d+ n5 R eeprom_read_block (p_header,eep_address,rd_number);% e3 J1 h) N# \6 K
}
: o1 `$ o4 W3 u2 c5 y |
|