📄 m62393.c
字号:
#include <reg51.h>
#include"demo.h"
void init_M62393()
{ BYTE i;
//I2C_SendByteWithStart(WRITE_M62393);
//I2C_SendByte(1);
//for(i=0; i<8; i++)
//{
//I2C_SendByte(Userdate.value3.bytes[i]);
// ShortDelay(5);
//}
//I2C_SendStop();
//I2C_ReleaseBus();
for(i=0; i<8; i++)
Set_M62393(i+1,Userdate.value3.bytes[i]);
}
bit Set_M62393(BYTE addr,BYTE val)
{
BYTE i;
BYTE temp;
I2C_SendByteWithStart(WRITE_M62393);
I2C_SendByte(addr);
for(i=0; i<8; i++)
{
temp = val;
temp >>= 7-i;
temp &= 0x01;
I2C_SDA = temp;
I2C_SCL = 1;
ShortDelay(2);
I2C_SCL = 0;
ShortDelay(2);
}
I2C_SendStop();
I2C_ReleaseBus();
return(I2C_GetACK());
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -