大侠们帮忙看看这个程序24c64读写程序 在keilc上运行时提示target not created,电脑是win7系统,跟这个有关系吗?
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
#define ulong unsigned long
#define writedeviceaddress oxa0//定义期间在ⅡC总线中得地址
#define readdeviceaddress oxa1
sbit wp=P2^5;
sbit sda=P2^6;
sbit scl=P2^7;
//延时函数
void DelayMs(unsigned int number)
{
unsigned char temp;
for(;number!=0;number--)
{
for(temp=112;temp!=0;temp--) ;
}
}
void Delay10us()
{
unsigned char k;
for(k=10;k!=0;k--)
;
}
//开始总线
void start()
{
sda=1;
Delay10us();
scl=1;
Delay10us();
sda=0;
Delay10us();
scl=0;
Delay10us();
}
//结束总线
void stop()
{
sda=0;
Delay10us();
sda=1;
Delay10us();
scl=1;
Delay10us();
}
void ack()
{
sda=0;
Delay10us();
scl=1;
Delay10us();
scl=0;
Delay10us();
}
void nack()
{
sda=1;
Delay10us();
scl=1;
Delay10us();
scl=0;
Delay10us();
}
bit send_byte(uchar d)
{
unsigned int i=8;
bit bit_ack;
while(i--)
{
if(d&0x80)
sda=1;
else
sda=0;
Delay10us();
scl=1;
Delay10us();
scl=0;
d=d<<1;
}
Delay10us();
sda=1;
Delay10us();
scl=1;
Delay10us();
bit_ack=sda;
scl=0;
Delay10us();
return bit_ack;
}
uchar receive_byte()
{
uchar i=8,d;
Delay10us();
sda=1;
while(i--)
{
d=d<<1;
Delay10us();
scl=1;
Delay10us();
if(sda)
d++;
Delay10us();
scl=0;
}
return d;
}
void AT24C64_write(void *mcu_address,uint AT24C64_address,uint count)
{
while(count--)
{
start();
send_byte(0xa0);
send_byte(AT24C64_address/256);
send_byte(AT24C64_address%256);
send_byte(*(uchar*)mcu_address);
stop();
DelayMs(10);
(*(uchar*)mcu_address)++;
AT24C64_address++;
}
}
void AT24C64_read(uchar *mcu_address,uint AT24C64_address,uint count)
{
while(count--)
{
start();
send_byte(0xa0);
send_byte(AT24C64_address/256);
send_byte(AT24C64_address%256);
start();
send_byte(0xa1);
nack();
stop();
DelayMs(10);
(*(uchar*)mcu_address)++;
AT24C64_address++;
}
}