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

📄 eeprom.h

📁 文件中代码实现对e2prom(at93c46/66)的读写
💻 H
字号:
/*----------------------------------------------------------------------------*/

/*
$Id: EEPROM.H,v 1.1.1.1 2002/03/20 08:47:34 antony_lo Exp $
*/
/*									      */
/*									      */
/*          (C) Copyright 2001-2004 Atan Technology, Inc.                     */
/*									      */
/*		   ***********  NOTICE  ***********                           */
/*      This Application Programming Interface for Terminal is only for       */
/*      demostrating ATAN 8989P Series chipset. Any distribution in source    */
/*      code style in prohibited. ATAN does not, nor any ATAN's employee,     */
/*      have the obligation to support any further modification. Any damage   */
/*      caused by this API should not be ATAN, nor any ATAN employee's        */
/*      liability.                                      		      */
/*									      */	
/*                    Code Written by Antony Lo                               */

/*
$Log: EEPROM.H,v $
Revision 1.1.1.1  2002/03/20 08:47:34  antony_lo
First Check in

*/
 
/*-----------------------------------------------------------------------------*/
#define ATC_93LC66              8
#define ATC_93LC46              6
#define EEPROM_TYPE_UNKNOWN     -1


#define  OPCODE_WRITE         	0x02
#define  OPCODE_READ            0x01
#define  OPCODE_CON             2

#define  LSB_MASK               0x01
#define  MSB_MASK               0x80


#define  ONE_BYTE_LEN           8

#define  EWEN_DATA              0x19
#define  EWDS_DATA              0x01
#define  EWEN_CON               5
#define  EWDS_CON               5


int CheckE2prom();                              //控制E2prom的读写和初始化

int EepromInit();
int SK_pulse();
void DisableEepromWrite();
void EnableEepromWrite() ;
int EepromWriteWord(BYTE address, BYTE lowByte, BYTE highByte);
int EepromReadWord(BYTE address, BYTE *plowByte, BYTE *phighByte);

#define EEPROM_REG_DECLARE        BYTE address, lowByte, highByte
#define EEPROM_TMP_REG_DECLARE        BYTE tmpaddress, tmplowByte, tmphighByte


#define READ_EEPROM_WORD          EepromReadWord( address, &lowByte, &highByte )
#define READ_TMP_EEPROM_WORD      EepromReadWord( tmpaddress, &tmplowByte, &tmphighByte )



#define WRITE_EEPROM_WORD		  EepromWriteWord( address, lowByte, highByte  )	

#define FROM_WORD_TO_2_BYTE(W)    lowByte = W & 0x00ff ;\
								  highByte = (W & 0xff00) >> 8

#define FROM_2_BYTE_TO_WORD(W)     W = (highByte << 8 | lowByte)


⌨️ 快捷键说明

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