下面是eeprom24c02的部分驱动程序,本人想在24c02存储一个字符串(20 21 22 23 24 25 26 27)字符串在变量unitTemp中 ,并且在主函数中调用驱动程序,不知道怎么调用?(uchar *s)啥意思?
uchar eeptemp;
void main(void)
{
while(1)
{
write_nbyte(a0,f0,uchar *s,5);
eeprtemp = read_nbyte(a0,f0,uchar *s,5);
unitTemp = eeprtemp;
}
//////////////////////////////////////////////////
bit write_nbyte(uchar slave,uchar addr,uchar *s,uchar numb) //向24c02中写n个字节
{
uchar i;
start_iic();
write_byte(slave);
if(F0 == 0) return 0;
write_byte(addr);
if(F0 == 0) return 0;
for(i=0; i<numb; i++)
{
write_byte(*s);
if(F0 == 0) return 0;
s++;
}
stop_iic();
return(1);
}
bit read_nbyte(uchar slave,uchar addr,uchar *s,uchar numb) //从24c02中读出n个字节
{
uchar i;
start_iic();
write_byte(slave);
if(F0 == 0) return 0;
write_byte(addr);
if(F0 == 0) return 0;
start_iic();
write_byte(slave);
if(F0 == 0) return 0;
for(i=0; i<numb-1; i++)
{
*s = read_byte();
ack_iic();
s++;
}
*s = read_byte();
nack_iic();
stop_iic();
return(1);
} |