⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 i2c_lib.h

📁 I2C example working program
💻 H
字号:
/*
***************************************************
*
*               I2C Library
*
*        For Keil C, with features of bus fault
*        detection, no acknowledgement feature,
*        and I2C busy feature.
*
*        I2C Data rate: 62,361 Bps
*
*        Written By: Ajay Bhargav
*        E-mail:     bhargav.ajay@gmail.com
*        website:    www.rickeyworld.tk
*
*  NOTE: It may or maynot be used with multi-master
*        Multislave confuguration
*        
*        Tested with multi-slave configuration
*
****************************************************
*  Having a doubt..?
*  post it on the rickey's forum @ Rickey's World
*  Visit www.rickeyworld.tk
*
****************************************************
*/

#ifndef __I2C_H
#define __I2C_H

#include <AT89X51.H>
#include <INTRINS.H>

typedef unsigned char ubyte;

/*
****************************************************
*       I2C Bus Configuration
*
****************************************************
*/

#define sda P1_0
#define scl P1_1
#define HOLD _nop_(); _nop_(); _nop_()

void send_stop();
void master(ubyte);
void send_byte(ubyte);
void send_data(ubyte, ubyte, ubyte, ubyte *);
ubyte recv_byte(ubyte);
void recv_data(ubyte, ubyte, ubyte, ubyte *);

#endif

⌨️ 快捷键说明

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