📄 at24c03.c
字号:
/*
* AT24C02 Two-wire Serial EEPROM
* ′|àí?÷ààDí£oC51
* °?±?£o1 è??ú£o2006-12-31
* ×÷??£o??μ?í?<yangdewang@gmail.com>
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA. Or, point your browser to
* http://www.gnu.org/copyleft/gpl.html
*/
#include <global.h>
#include "iic.h"
#include "at24c02.h"
#define Add24c 0x50
#ifdef MULTI_AT24C02
uint8 At24c02Choice;
#else
#define At24c02Choice (0)
#endif//MULTI_AT24C02
/*****************************************
D′êy?Yμ?24c02
×¢òa£o 1?óúò3D′??2???24c02??μμ
datAdd: êy?Yμ??·
Dat: êy?Y????
Count: êy?Y×??úêy
return: 3é1|D′è?×??úêy
******************************************/
uint8 Write24c02(uint8 datAdd,uint8* Dat,uint8 Count)
{
return I2CWriteBunch(Add24c|At24c02Choice,datAdd,Dat,Count);
}
/*****************************************
?áêy?Y′ó24c02
×¢òa£o áaD?μ??áè?í?D′è?ò??ùóDê±???T??
òò?a?ú?á?°?′DDá?D′?üá?ò?éè??μ??·
datAdd: êy?Yμ??·
dat: êy?Y????
count: êy?Y×??úêy
return: 3é1|?áè?×??úêy
******************************************/
uint8 Read24c02(uint8 datAdd,uint8* dat,uint8 count)
{
return I2CReadBunch(Add24c|At24c02Choice,datAdd,dat,count);
}
/*****************************************
á?D??áêy?Y′ó24c02
dat: êy?Y????
count: êy?Y×??úêy
return: 3é1|?áè?×??úêy
******************************************/
uint8 Read24c02Stream(uint8* dat,uint8 count)
{
return I2CReadStream(Add24c|At24c02Choice,dat,count);
}
#ifdef AT24C02_WRITEBYTE_U
bool WriteByte24c02(uint8 Add,uint8 dat) //D′ò?×??úμ?24c02//Add:μ??·£?dat:êy?Y£?re=true D′è?3é1|
{
return Write24c02(Add,&dat,1);
}
#endif AT24C02_WRITEBYTE_U
#ifdef AT24C02_READBYTE_U
bool ReadByte24c02(uint8 Add,uint8 *dat) //?áò?×??ú′ó24c02//Add:μ??·£?dat:êy?Y????£?re=true ?áè?3é1|
{
if(Read24c02(Add,dat,1)==1)
return true;
return false;
}
#endif//AT24C02_READBYTE_U
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -