用avr单片机io口模拟i2c总线操作at24cxx的通用程序(Using avr MCU IO to simulate the general procedure of i2c bus operation at24cxx).docVIP
- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
用avr单片机io口模拟i2c总线操作at24cxx的通用程序(Using avr MCU IO to simulate the general procedure of i2c bus operation at24cxx)
Using AVR MCU I/O to simulate I2C bus operation AT24CXX general procedure: the following is the implementation of I/O simulation I2C interface function:
Twi. H:
/ / twi. H
# # ifndef TWI_H
# define TWI_H
Void TwiInit (void);
Uint8_t TwiStart (void);
Void TwiStop (void);
Uint8_t TwiWriteByte uint8_t (c);
/ / read a byte of ack: TW_ACK at 1, TW_NOACK at 0
Uint8_t TwiReadByte (uint8_t * c, uint8_t ack);
/ / this value is 1 when I/O port simulation
/ / when the hardware TWI interface is 0x18, that is, when the SLA + W is sent, it receives the ACK state
# define NO_BUSY 0 x1
# endif
# endif
Twi. C:
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
AVR SCM I/O mouth-simulation I2C operation procedure
File name: twi. C
Compiler: WinAVR -Hardware: CA - M8X
Configuration: external 4MHz
Open: S7 (1, 2, 3) - EEPROM connection
S6 (1, 2) - 4MHz crystal oscillator connection
S5 (5, 6) - UART connection
Note: PC5 simulated SCL, PC4 analog SDA, PC3 connection write protection pins
Core art design room 2004-2007 all rights reserved
Please retain the full contents of this note
WEB:
Email: changfutong@
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * /
# include avr/IO. H
# include util/delay. H
# include stdint. H
/ * note:
The AVR SCM I/O interface is recommended to pull resistors on external connections when simulating the I2C bus
This can be set by changing the way I/O input/output direction is set
Exports remain unchanged (0)
At this point, the DDRX register is 1 and the output is 0
If DDRX is 0, then I/O port is high resistance, but because of the external upper pull resistance, the bus is equal to set high
By setting DDRX, the bus is controlled by the height of the bus
* /
# define SET_SCL DDRC = ~ _BV (PC5)
# define CLR_SCL DDRC | = _BV (PC5)
# define SET_SDA DDRC = ~ _BV (PC4)
# define CLR_SDA DDRC | = _BV (PC4)
# def
您可能关注的文档
- 西南交通大学网络教育入学考试模拟题(Southwest Jiao Tong University online education entrance exam simulation).doc
- 西气东输(West East Gas Pipeline Project).doc
- 西胜造式健康法六大法则(The six laws of the West Health Law).doc
- 西山林语(Xishan dialect).doc
- 西塘,乌镇游玩攻略,适用学生和一切想节约钱的孩子们(Xitang, Wuzhen Raiders, apply to students and all want to save money for children).doc
- 西塘(Xitang).doc
- 西塘攻略(Xitang Raiders).doc
- 西洋杜鹃栽培管理与花期调控技术(上中下)(Cultivation management and florescence regulation technique of Rhododendron (upper, middle and lower)).doc
- 西南石油大学油层物理复习资料3(Review of oil reservoir physics at Southwest Petroleum University 3).doc
- 西药名称(Western medicine name).doc
- 用c++模拟曲柄滑块装置(Simulate crank slider with c + +).doc
- 用cool edit pro等软件为歌曲做人声消除(Use software like cool edit pro to eliminate the sound of songs).doc
- 用ps制作漫画用网点(Use ps to make comics).doc
- 用点规范(Use a little specifications).doc
- 用光-影视摄像的效果)(Lighting - video camera effect).doc
- 用户报装流程2(User report process 2).doc
- 用万用表测线路板(Use a multimeter circuit board).doc
- 用真空蒸发结晶法制取无水硫酸钠(Sodium sulfite is used in vacuum evaporation crystallization method).doc
- 瑜伽的特点及价值(The characteristics and value of yoga).doc
- 用智能手机进行跟踪方法(Use your smartphone for tracking).doc
文档评论(0)