主题中讨论的其他器件:HDC1080、 CC1310、 SIMPLELINK-SDK-SENSOR-ACTUATOR-PLUGIN
工具/软件:Code Composer Studio
我通过观看 tmp006、i2ctmp 和 HDC1080/2 ü 그러나 연결되지 않습니다 尝试了很多东西。
你能举个例子吗?
我需要你的帮助。
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.
工具/软件:Code Composer Studio
我通过观看 tmp006、i2ctmp 和 HDC1080/2 ü 그러나 연결되지 않습니다 尝试了很多东西。
你能举个例子吗?
我需要你的帮助。
#include #include #include /*驱动程序头文件*/ #include #include #include /*示例/板头文件*/ #include "Board.h" #define TASKSTACKSIZE 768 静态 Display_Handle 显示; uint8_t txBuffer[1]; uint8_t rxBuffer[7]; I2C_Handle I2C; I2C_Params i2cParams; I2C_Transaction i2cTransaction; // *===== mainThread ==== // void * mainThread (void * arg0) { /*调用驱动程序初始化函数*/ display_init(); GPIO_init(); I2C_init(); /*配置 LED 以及 TMP116_EN 引脚(如果适用)*/ GPIO_setConfig (Board_GPIO_LED0、GPIO_CFG_OUT_STD | GPIO_CFG_OUT_LOW); #ifdef Board_GPIO_TMP116_EN GPIO_setConfig (Board_GPIO_TMP116_EN、GPIO_CFG_OUT_STD | GPIO_CFG_OUT_HIGH); TMP116的/* 1.5ms 复位时间*/ 睡眠(1); #endif /*打开主机显示屏以输出*/ Display = Display_open (Display_Type_UART、NULL); if (display =NULL){ while (1); } /*打开用户 LED */ GPIO_WRITE (Board_GPIO_LED0、Board_GPIO_LED_ON); display_printf (display、0、0、"启动 i2ctmp 示例。"); /*创建 I2C 以供使用*/ I2C_Params_init (&i2cParams); i2cParams.bitrate = I2C_100kHz; I2C = I2C_open (Board_I2C_TMP、&i2cParams); if (i2c == NULL){ Display_printf (display、0、0、"Error Initializing I2C\n"); while (1); } 否则{ display_printf (display、0、0、"I2C initialized!\n"\}); } /*通用 I2C 事务设置*/ i2cTransaction.slaveAddress =(0x68);//ds1307地址 TxBuffer[0]= 0x00; //ds1307写入模式 i2cTransaction.writeBuf = txBuffer; i2cTransaction.writeCount = 1; i2cTransaction.readBuf =空; i2cTransaction.ReadCount = 0; if (I2C_transfer (i2c、&i2cTransaction)){ } 否则{ display_printf (display、0、0、"I2C 总线故障"); } i2cTransaction.slaveAddress =(0x68);//ds1307地址 i2cTransaction.writeBuf =空; i2cTransaction.writeCount = 0; i2cTransaction.readBuf = rxBuffer; i2cTransaction.ReadCount = 7; if (I2C_transfer (i2c、&i2cTransaction)){ } 否则{ display_printf (display、0、0、"I2C 总线故障"); } /*睡眠1秒*/ 睡眠(1); I2C_Close (i2c); display_printf (display、0、0、"I2C closed!"); 返回(NULL); }
这是我的源代码和执行结果。
这是第一个传输波形
第二个传输波形。
我出了什么问题?