|
#include"AT24CXX.H"
#include"reg52.h"
sbit sda=P2^1;
sbit scl=P2^0;
////AT24C02
void Delay_at24cxx(unsigned int ms)//延时函数
{
unsigned int i;
while(ms--)
{
for(i=1;i<(8*143-2);i++)
;
}
}
void delay4()
{ ;; }
void start() //AT24CXX启动
{
sda=1;
delay4();
scl=1;
delay4();
sda=0;
delay4();
}
void stop() //AT24CXX停止
{
sda=0;
delay4();
scl=1;
delay4();
sda=1;
delay4();
}
void respons() ////??
{
uchar i;
scl=1;
delay4();
while((sda==1)&&(i<250))i++;
scl=0;
delay4();
}
//void init1()
//{
// sda=1;
// delay4();
// scl=1;
// delay4();
//}
void write_byte(uchar date)
{
uchar i,temp;
temp=date;
for(i=0;i<8;i++)
{
temp=temp<<1;
scl=0;
delay4();
sda=CY;
delay4();
scl=1;
delay4();
}
scl=0;
delay4();
sda=1;
delay4();
}
uchar read_byte()
{
uchar i,k;
scl=0;
delay4();
sda=1;
delay4();
for(i=0;i<8;i++)
{
scl=1;
delay4();
k=(k<<1)|sda;
scl=0;
delay4();
}
return k;
}
Build target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
compiling 12864.c...
compiling eeprom.c...
compiling finger.c...
compiling matrixkey.c...
compiling AT24CXX.C...
linking...
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS
SEGMENT: ?PR?_WRITE_DATA?AT24CXX
Program Size: data=72.0 xdata=100 code=4376
creating hex file from "..\Hex_out\frtg"...
"..\Hex_out\frtg" - 0 Error(s), 1 Warning(s).
|
|