IC總線讀寫程序-51
#include
#include
sbit SDA=P1^0;
sbit SCL=P1^1;
#define
#define delayNOP(); {_nop_();_nop_();_nop_();_nop_();};
unsigned char idata sendbuf[NUM];
unsigned char idata receivebuf[NUM];
bit
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: iic_start()
// 函數(shù)功能: 啟動I2C總線子程序
//--------------------------------------------------------------------------------------------------
void iic_start(void)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: iic_stop()
// 函數(shù)功能: 停止I2C總線數(shù)據(jù)傳送子程序
//--------------------------------------------------------------------------------------------------
void iic_stop(void)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: slave_ACK
// 函數(shù)功能: 從機發(fā)送應答位子程序
//--------------------------------------------------------------------------------------------------
void slave_ACK(void)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: slave_NOACK
// 函數(shù)功能: 從機發(fā)送非應答位子程序,迫使數(shù)據(jù)傳輸過程結(jié)束
//--------------------------------------------------------------------------------------------------
void slave_NOACK(void)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: check_ACK
// 函數(shù)功能: 主機應答位檢查子程序,迫使數(shù)據(jù)傳輸過程結(jié)束
//--------------------------------------------------------------------------------------------------
void check_ACK(void)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: IICSendByte
// 入口參數(shù): ch
// 函數(shù)功能: 發(fā)送一個字節(jié)
//--------------------------------------------------------------------------------------------------
void IICSendByte(unsigned char ch)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: IICreceiveByte
// 返回接收的數(shù)據(jù)
// 函數(shù)功能: 接收一字節(jié)子程序
//--------------------------------------------------------------------------------------------------
unsigned char IICreceiveByte(void)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: writeNbyte
// 入口參數(shù): slave_add從機地址,n要發(fā)送的數(shù)據(jù)個數(shù)
// 函數(shù)功能: 發(fā)送n位數(shù)據(jù)子程序
//--------------------------------------------------------------------------------------------------
void writeNbyte(unsigned char slave_add, unsigned char n)
{
}
//--------------------------------------------------------------------------------------------------
// 函數(shù)名稱: receiveNbyte
// 入口參數(shù): slave_add從機地址,n要接收的數(shù)據(jù)個數(shù)
// 函數(shù)功能: 接收n位數(shù)據(jù)子程序
//--------------------------------------------------------------------------------------------------
void receiveNbyte(unsigned char idata slave_add, unsigned char n)
{
}
評論