/*******************************************************************
º¯ÊýÃû £ºRead_FM_Data
ÃèÊö £ºFMÄ£¿é¼Ä´æÆ÷Á¬Ðø¶Á³ö
ÊäÈë £ºÊý×éÃûÖ¸Õë
·µ»Ø £ºÎÞ
µ÷Óà £ºÄÚ²¿µ÷ÓÃ
*******************************************************************/
sta
tic void Read_FM_Data(uint8_t *Readbuf)
{
uint8_t i; //Ñ»·¼ÆÊý
while(I2C_GetFlagStatus(I2C1,I2C_FLAG_BUSY)==SET);//²éæ
I2C_GenerateSTART(I2C1,ENABLE); //I2CÆðʼÐźÅ
/*È·ÈÏEV5ʼþ·¢Éú*/
while(I2C_CheckEvent(I2C1,I2C_EVENT_MASTER_MODE_SELECT)==SUCCESS);
I2C_Send7bitAddress(I2C1,FM_addr,I2C_Direction_Receiver);
/*È·ÈÏEV6ʼþ·¢Éú*/
while(I2C_CheckEvent(I2C1,I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED)==SUCCESS);
for(i=0;i<=3;i++)
{
*(Readbuf+i)=I2C_ReceiveData(I2C1);
/*È·ÈÏEV7ʼþ·¢Éú*/
while(I2C_CheckEvent(I2C1,I2C_EVENT_MASTER_BYTE_RECEIVED)==SUCCESS);
}
I2C_GenerateSTOP(I2C1,ENABLE); //I2CÖÕÖ¹ÐźÅ
}
/********************************************************************/
乱码请忽视。读出的寄存器数据全部为0x21,RDA
芯片的地址是0x20。不知道是i2c配置问题,还是rda的寄存器操作不对。求看看问题
一周热门 更多>