?? iic_drv.h
字號(hào):
/***********************************************************************/
/* */
/* FILE :iic_drv.h */
/* DATE :2005-7-27 12:49 */
/* DESCRIPTION :Define IIC Functions */
/* CPU TYPE : */
/* FUNCTION :send and receive functions */
/* */
/* */
/***********************************************************************/
#include "typedefine.h"
//#define DEVICEADDR_WR (0xa0)
//#define DEVICEADDR_RD (0xa1)
#ifndef IICDRV
#define IICDRV
#define DEVICEADDR (0x50)
#define SDADIR pd7_0
#define SCLDIR pd7_1
#define SDAPORT p7_0
#define SCLPORT p7_1
#define SETSDAIN SDADIR = 0
#define SETSCLIN SCLDIR = 0
#define SETSDAOUT SDADIR = 1
#define PAGE_WIDTH (8)
#define RECEIVE_BUF_SIZE (8)
//#define NMOS
#ifdef NMOS
#define SETSCL SCLPORT = 1,SCLDIR = 1
#define SETSDA SDAPORT = 1,SDADIR = 1
#else
#define SETSCL SETSCLIN
#define SETSDA SETSDAIN
#endif
#define CLRSCL SCLPORT = 0,SCLDIR = 1
#define CLRSDA SDAPORT = 0,SDADIR = 1
static void iic_ini(void);
static void iic_sta(void); /* set iic bus to START condition */
static void iic_stop(void); /* set iic bus to STOP condition */
static UINT_8 sendbyte(const UINT_8 data); /* send a byte of data out from SDA pin */
static UINT_8 readbyte(); /* read a byte of data in from SDA pin */
static void iic_sendack(const UINT_8 ack); /* send an ACK or NOACK out from SDA pin */
BOOLEAN iic_byte_write(const SINT_8 dev_adr,const UINT_8 word_adr,UINT_8 data); /* write a byte of data to EEPROM */
BOOLEAN iic_currentadr_read(const SINT_8 dev_adr, UINT_8 * const rdram); /* write a page of data to EEPROM */
BOOLEAN iic_page_write(const SINT_8 dev_adr,const UINT_8 word_adr,UINT_8 * data_point,const UINT_8 data_no); /* read a byte of data at current EEPROM address */
BOOLEAN iic_random_read(const SINT_8 dev_adr,const UINT_8 word_adr,UINT_8 * const rdram); /* read a byte of data at the specified EEPROM address */
BOOLEAN iic_sequ_read(const SINT_8 dev_adr,const UINT_8 word_adr,UINT_8 data_no,UINT_8 * rdram_array); /* initiated by random address read and read data_no bytes sequentially */
#endif
//UINT_8 eeprom_data_send[TRANSMIT_BUF_SIZE]; /* data send buffer */
//UINT_8 eeprom_data_rece[RECEIVE_BUF_SIZE]; /* data receive buffer */
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -