#include "stm32f10x.h"
#include "Delay.h"
#include "OLED.h"
#include "MyI2C.h"
uint8_t i=0x00,Addr_Count=0;
int main(void)
{
OLED_Init();
MyI2C_Init();
OLED_ShowString (1,1,"I2C:0x00->");
for(i=0x00;i<0x80;i++)
{
MyI2C_Start ();
MyI2C_SendByte (i<<1);
OLED_ShowString (1,12,"0x");
OLED_ShowHexNum (1,14,i,2);
uint8_t Ack = MyI2C_ReceiveAck ();
if (Ack == 0)
{
Addr_Count ++;
if(Addr_Count<5)
{
OLED_ShowString (2,Addr_Count*4-3,"0x");
OLED_ShowHexNum (2,Addr_Count*4-1,i,2);
}
else if (Addr_Count>=5 & Addr_Count<9)
{
OLED_ShowString (3,Addr_Count*4-3-16,"0x");
OLED_ShowHexNum (3,Addr_Count*4-1-16,i,2);
}
else
{
OLED_ShowString (4,Addr_Count*4-3-16-16,"0x");
OLED_ShowHexNum (4,Addr_Count*4-1-16-16,i,2);
}
}
MyI2C_Stop ();
Delay_ms(20);
}
while (1)
{
}
}