|
没用过ATMEGA329P,用ATMEL16\32,用它的库来读写EEPROM,这是用AVR编译器的
* q% X8 _0 L0 L7 G' @! F$ s+ Q3 N#include <avr/eeprom.h>% W, W: R% ?9 p: Z. j
void EEPROM_WRITE(unsigned char eep_address,unsigned char wr_number,unsigned char* p_header)
0 k X+ M1 I q* L{ . a/ _& A3 X" E. q) @2 E; b
eeprom_busy_wait();
' X: O5 J! D* d( _& V" e% N6 T v eeprom_write_block (p_header,eep_address, wr_number);- @5 v# f% P2 c: L! f& |( _" p
}9 U9 J6 C7 A: v2 B
5 C( \! e3 i! d+ x
void EEPROM_READ(unsigned char eep_address,unsigned char rd_number,unsigned char * p_header) M( `: e) T; W- J1 V9 ~
{
) |+ X7 X* N$ n- s) m, b eeprom_busy_wait();
4 m8 U4 G* M9 z8 [" N: s5 [ eeprom_read_block (p_header,eep_address,rd_number);
( V) o' H: ]+ Z) N}& K3 m' @8 X: _* _/ H* g* X
|
|