“STM8 AT24CXX使用I2C接口读写EEPROM子程序”的版本间的差异
来自丢石头百科
小 (文本替换 - 替换“www.waveshare.net”为“{{SERVERNAME}}”) |
小 (文本替换 - 替换“http://{{”为“https://{{”) |
||
第2行: | 第2行: | ||
<table border="0" cellpadding="0" cellspacing="0" style="color: rgb(72, 61, 139); font-family: Arial, 新宋体, 微软雅黑; font-size: 12px;" width="120"><tbody><tr><th align="center" bgcolor="#698192" class="white_12px_b" height="20" scope="col" style="color: rgb(255, 255, 255); line-height: 20px; font-family: Arial, Helvetica, sans-serif;">软件设计</th></tr></tbody></table> | <table border="0" cellpadding="0" cellspacing="0" style="color: rgb(72, 61, 139); font-family: Arial, 新宋体, 微软雅黑; font-size: 12px;" width="120"><tbody><tr><th align="center" bgcolor="#698192" class="white_12px_b" height="20" scope="col" style="color: rgb(255, 255, 255); line-height: 20px; font-family: Arial, Helvetica, sans-serif;">软件设计</th></tr></tbody></table> | ||
/********************************************************************* | /********************************************************************* | ||
− | 微 雪 电 子 WaveShare <a class="Blue_2_12px_" href=" | + | 微 雪 电 子 WaveShare <a class="Blue_2_12px_" href="https://{{SERVERNAME}}/" style="color: rgb(7, 66, 184);">http://www.waveShare.net |
目 的: 建立AT24CXX操作库 | 目 的: 建立AT24CXX操作库 |
2021年6月18日 (五) 18:00的最新版本
<tbody></tbody>
软件设计 |
---|
/********************************************************************* 微 雪 电 子 WaveShare <a class="Blue_2_12px_" href="https://wiki.diustou.com/" style="color: rgb(7, 66, 184);">http://www.waveShare.net 目 的: 建立AT24CXX操作库 目标系统: 基于STM8单片机 应用软件: Cosmic CxSTM8 说 明: 若用于商业用途,请保留此段文字或注明代码来源 深 圳 市 微 雪 电 子 有 限 公 司 保 留 所 有 的 版 权
- /
#define WD_DADR 0xa0 #define RD_DADR 0xa1 #include "ws_i2c.h" void AT24CXX_Init(void) { I2C_Init(); } void AT24CXX_WriteAByte(u8 wordAdr,u8 dat) { I2C_Start(); I2C_SendDAdr(WD_DADR); I2C_SendDat(wordAdr); I2C_SendDat(dat); I2C_stop(); } u8 AT24CXX_ReadAByte(u8 wordAdr) { u8 dat; I2C_Start(); I2C_SendDAdr(WD_DADR); I2C_SendDat(wordAdr); I2C_Start(); I2C_NAck(); I2C_SendDAdr(RD_DADR); dat=I2C_RcvDat(); I2C_stop(); I2C_Ack(); return dat; }
- /