openi2c.c

来自「Microchip的官方PIC24H系列16位单片机的外设源程序库。」· C语言 代码 · 共 23 行

C
23
字号
#include <i2c.h>
#include <p30fxxxx.h>

/******************************************************************************
*    Function Name:  OpenI2C
*    Description:    This function configures the I2C module for enable bit, 
*                    disable slew rate, SM bus input levels, SCL release,
*                    Intelligent Peripheral Management Interface enable, 
*                    sleep mode, general call enable,acknowledge data bit, 
*                    acknowledge sequence enable, receive enable, stop 
*                    condition enable, restart condition enable and start
*                    condition enable. The Baud rate  value is also configured  					 
*    Parameters:     unsigned int : config1
*                    unsigned int : config2 									
*    Return Value:   void
*******************************************************************************/

void OpenI2C(unsigned int config1,unsigned int config2)
{
    I2CBRG = config2;
    I2CCON = config1;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?