|
没用过ATMEGA329P,用ATMEL16\32,用它的库来读写EEPROM,这是用AVR编译器的; A' e6 s2 ]# w' W5 j+ L( k& N
#include <avr/eeprom.h>
/ s& @$ R- e. D( ?9 Ovoid EEPROM_WRITE(unsigned char eep_address,unsigned char wr_number,unsigned char* p_header)
: u/ m2 I5 h* X* q1 H3 d! {, n{ 2 K8 f6 p/ Q- S! s+ @- M( q
eeprom_busy_wait();
9 R3 I- ?" E v6 F eeprom_write_block (p_header,eep_address, wr_number);
/ a$ g& v% w5 K3 _" i}
0 E. Z! C. Z& g) G5 H
$ ^; D3 `2 L/ m& Y- E% Bvoid EEPROM_READ(unsigned char eep_address,unsigned char rd_number,unsigned char * p_header)% r4 U% [# t% p: i
{ `1 M8 i' i) e, A: C
eeprom_busy_wait();$ d: ?, U* Q' M- V
eeprom_read_block (p_header,eep_address,rd_number);8 _1 t* A! e/ ]2 O; H: d
}
8 R# E$ U) R3 I+ y |
|