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

📄 i2c_demo.h

📁 renasas m16c上实现iic通信的源代码.
💻 H
字号:
/**************************************************************************
*
*   $Id: i2c_demo.h,v 1.1 1999-08-11 15:27:48-04 bembry Exp bembry $
*   Module  :   I2C_DEMO.C
*   Purpose :   Demo I2C Bus Program
*
*   Author  :   Mike Barker (Integrity Electronics)	SPI demo
*				Modified for I2C demo program by Bruce A Embry 
				Mitsubishi Electronics America DEC-EAST
*   Date    :   March 1999
*
*   Description :   M16C I2C interface demonstration program
*
*   This program demonstrates the use a UART2 in the clock-syncronous
*   mode to implement a I2C bus which communicates with a Microchip 24AA256
*   32K x 8 bit EEPROM.  Commands are sent via an RS232 channel using
*   another UART0
*
*   Change Log  :
*
*   V1.00   04/18/98    MJB - Original Documentation.
*	V1.00	03/99		MELA 
*
*
*   Copyright,1999, 1998
*		Mitsubishi Semiconductor America, Inc.	 
*		MITSUBISHI ELECTRIC CORPORATION AND			 
*       MITSUBISHI ELECTRIC SEMICONDUCTOR SOFTWARE CORPORATION
*								 
*	Note:							 
*       This program was written for the M16C Starter Kit (MSA0654 rev. C)
*
*   $Log: i2c_demo.h,v $
*   Revision 1.1  1999-08-11 15:27:48-04  bembry
*   Initial revision
*
*
**************************************************************************/
 #define SIZE_OF_DATA_RECORDS	45 /* bytes	 */
 #define NO_OF_EEPROM_CMDS 	2

typedef union {
 struct data_base
	{
	char	active;				  /* active data or not */	
	char	first_name[20];
	char	last_name[20];
	long	ph_num;			 /* stored as BCD each data record consumes 45 byts. */
	};
 char data_str[SIZE_OF_DATA_RECORDS	];
	}UN_DATA_BASE;

UN_DATA_BASE da_ba[5];		/* local ram buffer for data base. */
UN_DATA_BASE *da_ba_ptr;	

enum eeprom_cmd_indices
{
    READ_EEPROM,
    WRITE_EEPROM
};

typedef struct  _eeprom_cmd_struct
{
    byte        cmd;        /* Command number  */
    char        name[25];   /* Name Of Command */
} eeprom_cmd_type;

const eeprom_cmd_type eeprom_cmd[NO_OF_EEPROM_CMDS] =
{
    {  READ_EEPROM,  		"Read  EEPROM ", 		},
    {  WRITE_EEPROM, 		"Write EEPROM ", 		}
};

⌨️ 快捷键说明

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