..............................................................................................................................................................................72
void write_byte_eeprom(uint8 addr_eeprom, uint8 write_data_eeprom) //
从
MCU
移出数据到
AT24C02......72
{.............................................................................................................................................................................72
start_eeprom();....................................................................................................................................................72
shout_eeprom(OP_WRITE);................................................................................................................................72
shout_eeprom(addr_eeprom);.............................................................................................................................72
shout_eeprom(write_data_eeprom);...................................................................................................................72
stop_eeprom();.....................................................................................................................................................72
DelayNOP_EEPROM();......................................................................................................................................72
Delayms_eeprom(10); //
写入周期
.....................................................................................................................72
}.............................................................................................................................................................................72
void fill_byte_eeprom(uint8 fill_size, uint8 fill_data) //
填充数据
fill_data
到
EEPROM
内
fill_size
字节
........72
{.............................................................................................................................................................................72
uint8 i_eeprom_num;...........................................................................................................................................72
for(i_eeprom_num=0; i_eeprom_num<fill_size; i_eeprom_num++)................................................................72
{............................................................................................................................................................................72
write_byte_eeprom(i_eeprom_num, fill_data);...................................................................................................72
}............................................................................................................................................................................72
}.............................................................................................................................................................................72
uint8 read_current_eeprom(void) //
在当前地址读取
..........................................................................................73
{.............................................................................................................................................................................73
uint8 read_data_eeprom;....................................................................................................................................73
start_eeprom();....................................................................................................................................................73
shout_eeprom(OP_READ);.................................................................................................................................73
read_data_eeprom = shin_eeprom();..................................................................................................................73
stop_eeprom();.....................................................................................................................................................73
return read_data_eeprom;...................................................................................................................................73
}.............................................................................................................................................................................73
uint8 read_random_eeprom(uint8 random_addr_eeprom) //
在指定地址读取
...................................................73
{.............................................................................................................................................................................73
start_eeprom();....................................................................................................................................................73
shout_eeprom(OP_WRITE);................................................................................................................................73
shout_eeprom(random_addr_eeprom);...............................................................................................................73
return(read_current_eeprom());..........................................................................................................................73
}.............................................................................................................................................................................73
#endif//
对应
#if FALSE..........................................................................................................................................73
#endif//
对应
#ifndef...............................................................................................................................................73
/*********************speed***********************/...........................................................................73
BYTE flag=0;........................................................................................................................................................73
void get_speed(void).............................................................................................................................................73
{.............................................................................................................................................................................73
TMOD=0X51;//T1
计数
T0
定时 均为方式
1....................................................................................................73
TH1=0;................................................................................................................................................................73
TL1=0;.................................................................................................................................................................73