小学生
最后登录1970-1-1
在线时间 小时
注册时间2021-10-13
|
楼主 |
发表于 2021-10-13 20:24:10
|
显示全部楼层
#include "stm32f10x.h"
#include "./led/bsp_led.h"
#include "./uart/bsp_uart.h"
#include "./i2c/bsp_i2c_gpio.h"
#include "./i2c/bsp_i2c_ee.h"
void delay(uint32_t count)
{
int j;
for (; count != 0; count--)
{
for (j = 1000; j != 0; j--);
}
}
int main()
{
uint8_t w_data[10] = {0,1,2,3,4,5,6,7,8};
uint8_t r_data[10] = {0};
uint8_t i;
UART_Config();
I2C_GPIO_Config();
printf("中文EEPROM\n\n");
if (ee_CHECK_DEVICE(EEPROM_ADDR | EEPROM_WRITE_DIR) == 0)
{
printf("检测正常\n");
}
else
{
printf("检测异常\n");
}
if (ee_WRITE_BYTES(5, w_data, 8) == 0)
{
printf("写入到EEPROM\n");
}
else
{
printf("写入异常\n");
}
if (ee_READ_BYTES(5, r_data, 10) == 0)
{
printf("读取的值为:\n");
for(i=0; i<10; i++)
{
printf("%d ", r_data[i]);
}
}
else
{
printf("读取异常\n");
}
while (1);
}
|
|