模拟I2C控制24C02(7)

发布时间:2021-06-06

使用STM32红牛开发的GPIO模拟I2C控制八个AT24C02的读写

/* Includes ------------------------------------------------------------------*/

#include "i2c_ee.h"

/* Private typedef -----------------------------------------------------------*/

typedef enum {FAILED = 0, PASSED = !FAILED} TestStatus;

/* Private define ------------------------------------------------------------*/

#define EEPROM_WriteAddress1 0xa6

#define EEPROM_ReadAddress1 0xa6

#define BufferSize1 countof(Tx1_Buffer)

/* Private macro -------------------------------------------------------------*/

#define countof(a) (sizeof(a) / sizeof(*(a)))

u8 Tx1_Buffer[] = {

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,

1,2,3,4,5,6,7,8,9,10 //共写入250字节

};

u8 Tx2_Buffer[] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};

u8 Rx1_Buffer[BufferSize1];

volatile TestStatus TransferStatus1 = FAILED, TransferStatus2 = FAILED;

ErrorStatus HSEStartUpStatus;

/* Private functions ---------------------------------------------------------*/

void RCC_Configuration(void);

void NVIC_Configuration(void);

TestStatus Buffercmp(u8* pBuffer1, u8* pBuffer2, u16 BufferLength);

int main(void)

{

#ifdef DEBUG

debug();

#endif

模拟I2C控制24C02(7).doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219