// CONS,AT24C" />
null

at24c64 read and write program

  • 2013-09-19
  • 8.47KB
  • Points it Requires : 2

// 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<

unfold

You Might Like

Uploader
mamselc
 

Recommended ContentMore

Popular Components

Just Take a LookMore

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
×