void a10987_Write(u8 RegAdd,u8 DataToWriteH,u8 DataToWriteL)
{ IIC_Start(); IIC_Send_Byte(0xA4);
IIC_Wait_Ack();
IIC_Send_Byte(RegAdd);
IIC_Wait_Ack(); IIC_Send_Byte(DataToWriteH);
IIC_Wait_Ack(); IIC_Send_Byte(DataToWriteL);
IIC_Wait_Ack(); IIC_Stop();//²úÉúÒ»¸öÍ£Ö¹Ìõ¼þ delay_ms(10);}
u16 a10987_Read(u8 RegAdd)
{ u8 temp[2]={0};
u16 readdata; IIC_Start(); IIC_Send_Byte(0xA4); //DRV10987µÄslave addressÊÇ101 0010,R/WλΪ0±íʾоƬ½øÐÐд²Ù×÷£¬ÈôÊǶÁ²Ù×÷ÔòΪ0xA5 IIC_Wait_Ack();
IIC_Send_Byte(RegAdd);
IIC_Wait_Ack(); IIC_Start();
IIC_Send_Byte(0xA5);
temp[0]=IIC_Read_Byte(1);
temp[1]=IIC_Read_Byte(1);
readdata=((temp[0]<<8)|(temp[1]));
IIC_Stop();
delay_ms(10); return readdata;}
Kevin Shi:
您好!
感谢使用TI的产品。
有关drv10987的问题推荐您到马达驱动论坛提问。
https://e2echina.ti.com/question_answer/analog/other_analog/
谢谢