📄 rw24c16.c
字号:
#include <reg51.h> /* define 8051 registers */
#include <stdio.h>
#include "demo.h"
BYTE read24c16(BYTE address)
{
BYTE temp;
I2C_SendStop();
I2C_SendByteWithStart(EEPROMWRITEID);////first 256 byte all is 8*256
I2C_SendByte(address);
I2C_SendStop();
I2C_SendByteWithStart(EEPROMREADID);
temp = I2C_GetLastByte();
I2C_SendStop();
I2C_ReleaseBus();
return(temp);
}
void write24c16(BYTE address,BYTE value)
{
I2C_SendStop();
I2C_SendByteWithStart(EEPROMWRITEID); //first 256 byte all is 8*256
I2C_SendByte(address);
ShortDelay(5);
I2C_SendByte(value);
ShortDelay(5);
I2C_SendStop();
I2C_ReleaseBus();
ShortDelay(255);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -