// AT24C64 support functions using ATMEGA\'s TWI// pin-WP is hard-wired to GND// fuctions work better outside interrupt routines// by MXH, 2003/07/30#i nclude \"DStruct.h\"#i nclude // CONSTANTS DEFINITION FOR EEPROM#define EEADDR 0#define EEWR 0#define EERD 1// TWINT *NOT* set after STOP condition is sent// check status?// TWSTO is cleared by hardware#define TwiStop() TWCR = _BV(TWINT) | _BV(TWEN) | _BV(TWSTO)#define TwiStart() TWCR = _BV(TWINT) | _BV(TWEN) | _BV(TWSTA)#define TWI_STATUS (TWSR & 0xF8)BYTE byEEWait;//////////////////////////////////////////////////////////////////////////// implementationBOOL EEPStart(BYTE addr, BOOL bWrite){byEEWait = 10; // 90~100mspoll_ack:TwiStart();while (!(TWCR & (1<>8)&0x00ff); // MSB of addressTWCR = (1<> 8) & 0x00ff ); //((BYTE*)(&uiAddress))[1]; // MSB of addressTWCR = (1<