This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] 编译器/TM4C123GH6PM:关于 TM4C123GH6PM 硬件 IIC 中断问题

Guru**** 2033340 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/773023/compiler-tm4c123gh6pm-about-tm4c123gh6pm-hardware-iic-interrupt-problem

器件型号:TM4C123GH6PM

工具/软件:TI C/c++m 编译器 Ω

现在我的问题是使用硬件 IIC 中断来读取 MPU6050中多个寄存器的地址、但我现在只能读取一个寄存器。 当我将其设置为读取多个寄存器时、数据将不同于同一寄存器的数据。  我的想法是、tm4c 写入 MPU6050的多个寄存器、将每次在中断中接收到的数据写入数组、最后对数组中的数据进行排序、并使用串行端口将其发送到上部计算机。这是我的代码。
extern short 计数;
extern text_num;
extern unsigned char Data[5];
空 I2C0SlaveIntHandler()
清除中断标志位 μ s
I2CMasterIntClear (I2C0_BASE);
text_num = I2CMasterDataGet (I2C0_BASE);
计数= 0;
data[count]=text_num;
count = count + 1;
如果(count=6) count=0;
空 init_write (uint8_t slave_addr、uint8_t reg_addr)
I2CMasterSlaveAddrSet (I2C0_BASE、SLAVE_addr、false);
I2CMasterDataPut (I2C0_BASE、REG_addr);
I2CMasterControl (I2C0_BASE、I2C_MASTER_CMD_BURST_SEND_START);//true
while (I2CMasterBusy (I2C0_BASE));
I2CMasterSlaveAddrSet (I2C0_BASE、SLAVE_addr、TRUE);
I2CMasterControl (I2C0_BASE、I2C_MASTER_CMD_SINGLE_Receive);//true
while (I2CMasterBusy (I2C0_BASE));
空 Write_MultipleSlave (uint8_t slave_addr、uint8_t reg_addr、uint8_t num)
静态 uint8_t i=0;
对于(i=0 <num;i++)
init_write (slave_addr、reg_addr);
reg_addr=reg_addr+1;
int main (空)
使能FPU μ s
FPUEnable();
FPULazyStackingEnable();
SysCtlClockSet (SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHz|SYSCTL_OSC_MAIN);
init_MPU6050 ();
UART0_Init();
  while (1)
  {
   Write_MultipleSlave (MPU6050_Addr、MPU_ACCEL_XOUTH_REG、6);
   acce_x=((U16) Data[0][<8)|Data[1];
   UART0_Report_IMU (Acce_x、Acce_y、Acce_z、Gyro_x、Gyro_y、Gyro_z、1、1、2、2);串口发送 μ s
  }
期待您的帮助、我想问您来自哪个国家/地区、您可以使用中文吗? 我的英语太差了、每次都要使用翻译软件

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    请按照 您就本主题提交的主题进行操作。

    谢谢、此致、

    乔治