void DispMenuTopUp()//菜单函数,在Menu.c文件
{
unsigned char i,data[16];
for(i=0;i<16;i++) { data = i;}//数值初始化
Clock_I2C_EEPROM_PageWrite(0,16,data);//写进去,用EEPROM随机读函数可以读出正确的数据
// for(i=0;i<16;i++) { data = 0; }
Clock_I2C_EEPROM_PageRead(0,16,data); //页读,读出来
i=data[1]; //赋值
lcd_display_zifu(1,1,shuzi[i/100],0); //显示值,应该是001,去始终是255
lcd_display_zifu(2,1,shuzi[i/10%10],0);
lcd_display_zifu(3,1,shuzi[i%10],0);
}
//EEPROM页读函数,在eeprom.c文件
void Clock_I2C_EEPROM_PageRead (unsigned char ReadPage,unsigned char NumByteToRead,unsigned char *p)
{
unsigned int ReadAddr;
ReadAddr = ReadPage*16+64;//计算每页的首地址(跳过0-3f空间)
while(NumByteToRead--)
{*p++ = Clock_I2C_EEPROM_RandomRead(ReadAddr++);}//读数据
}
// EEPROM随机读函数,在eeprom.c文件 此函数使用正常
unsigned char Clock_I2C_EEPROM_RandomRead(unsigned int ReadAddr)
{ unsigned char Data;
I2C_Start();// IIC开始
Send_Data(EEPROM_White_Addr); //送RTC写寻址地址
Send_Data(ReadAddr >> 8); //送目标地址H
Send_Data(ReadAddr & 0x00ff); //送目标地址L
I2C_Start();// IIC再开始
Send_Data(EEPROM_Read_Addr);//送RTC读寻址地址
Data = Receive_Data(NOACKbit);//读数据
I2C_Stop(); //IIC结束
return Data;
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
void DispMenuTopUp()//菜单函数,在Menu.c文件
{
unsigned char i,data[16];
for(i=0;i<16;i++) { data = i;}//数值初始化
Clock_I2C_EEPROM_PageWrite(0,16,data);//写进去,用EEPROM随机读函数可以读出正确的数据
// for(i=0;i<16;i++) { data = 0; }
Clock_I2C_EEPROM_PageRead(0,16,data); //页读,读出来
i=data[1]; //赋值
lcd_display_zifu(1,1,shuzi[i/100],0); //显示值,应该是001,去始终是255
lcd_display_zifu(2,1,shuzi[i/10%10],0);
lcd_display_zifu(3,1,shuzi[i%10],0);
}
//EEPROM页读函数,在eeprom.c文件
void Clock_I2C_EEPROM_PageRead (unsigned char ReadPage,unsigned char NumByteToRead,unsigned char *p)
{
unsigned int ReadAddr;
ReadAddr = ReadPage*16+64;//计算每页的首地址(跳过0-3f空间)
while(NumByteToRead--)
{*p++ = Clock_I2C_EEPROM_RandomRead(ReadAddr++);}//读数据
}
// EEPROM随机读函数,在eeprom.c文件 此函数使用正常
unsigned char Clock_I2C_EEPROM_RandomRead(unsigned int ReadAddr)
{ unsigned char Data;
I2C_Start();// IIC开始
Send_Data(EEPROM_White_Addr); //送RTC写寻址地址
Send_Data(ReadAddr >> 8); //送目标地址H
Send_Data(ReadAddr & 0x00ff); //送目标地址L
I2C_Start();// IIC再开始
Send_Data(EEPROM_Read_Addr);//送RTC读寻址地址
Data = Receive_Data(NOACKbit);//读数据
I2C_Stop(); //IIC结束
return Data;
}
昨天捣鼓也没弄好,始终是斜体,今天回复下就好了,奇怪
一周热门 更多>