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.

[参考译文] MSP430FR5969:用于 MSP430FR5969微控制器与 TMP117温度传感器通信的 I2C 示例代码

Guru**** 2195940 points
Other Parts Discussed in Thread: TMP117, MSP430FR5969, SYSCONFIG, TMP007, BOOSTXL-BASSENSORS, MSP430F5528
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor

器件型号:MSP430FR5969
主题中讨论的其他器件:TMP117SysConfigBOOSTXL-SENSORSBOOSTXL-BASSENSORSMSP430F5528

您好!

是否有任何用于 MSP430FR5969微控制器与 TMP117温度传感器通信的 I2C 示例代码。 我已经从 SysConfig 工具中下载了 tmp117.c、tmp117.h、mcu.c、mcu.h 和 main.c、但 mcu.c 文件必须针对 MSP430FR5969 I2C 外设进行修改。 任何示例代码都将非常有帮助、谢谢。  

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

    您好!

    SysConfig 工具不支持 MSP430、具体取决于 SysConfig 页面上列出的器件。 我建议从以下资源开始:

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

    尊敬的 James:  

    感谢你的答复。  

    但可以为 MSP430 MCU 修改 mcu.c 文件。 是否可以使用 msp430fr59xx_eusci_i2c_standard_master.c 文件的函数(如上所述)并修改 mcu.c 文件以从传感器获取数据。  

    e2e.ti.com/.../8508.mcu.ce2e.ti.com/.../6763.mcu.he2e.ti.com/.../8764.main.ce2e.ti.com/.../5758.TMP117.ce2e.ti.com/.../6116.TMP117.h

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

    我将从我提到的资源开始、而不是尝试修改 mcu.c 文件。 您在哪里找到了这些文件?

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

    我从 SynsConfig 工具下载了这些文件、请查看以下链接:

    https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/871962/ccs-tmp117-can-you-provide-tmp117-sensor-read-write-config-sample-code-by-i2c

    https://dev.ti.com/sysconfig/index.html?product=ascstudio&module=/ti/sensors/tempsensor/TMP116

    https://e2e.ti.com/support/sensors-group/sensors/f/sensors-forum/990448/faq-sysconfig-ascstudio-mcu-c-example-code-for-arduino-i2c?tisearch=e2e-sitesearch&keymatch=mcu.c#

    我已经介绍了您建议的资源、但我最感兴趣的是在我的项目中使用 MSP430FR5969 MCU、而不是 BOOSTXL-SENSORS BoosterPack。

    非常感谢  

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

    感谢您分享链接。 如果未提供源代码、则很难知道在何处查找提到的文件。 我们的温度传感器团队负责这些 SysConfig 项目、因此我不熟悉它们。 我下载了几个文件、例如"mcu.c"、"main.c"、"tmp117.c"等。我认为您之前对从 I2C 代码示例向这些文件添加代码的评论是合理的。

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3739715 #3739715"]我已经介绍了您建议的资源、但我最感兴趣的是在我的项目中使用 MSP430FR5969 MCU、而不是 BOOSTXL-SENSORS BoosterPack。

    请记住、BoosterPack 不包含 MCU、是可以插入 LaunchPad 的简单低成本传感器模块。 LaunchPad 将具有 MSP430FR5969等 MCU、BoosterPack 使您  无需跳线或试验板即可快速轻松地将 MCU 连接到其他传感器。  BOOSTXL-SENSORS BoosterPack 应包含一些代码示例、这些代码示例将为您的开发提供有价值的参考、即使 TMP 器件稍有不同。 我找到了较新 的 BOOSTXL-BASSENSORS BoosterPack、它具有 TMP117传感器、但代码示例都是基于 RTOS 的、我看不到任何适用于 MSP430 MCU 的示例。 因此、我将使用另一个 BoosterPack 中的示例作为参考。  例如、查看'i2c_driver.c'文件。 这似乎使用了 DriverLib、这可能会为您节省一些工作。

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

    这是我用于在基于 MSP430F5528的 EVM 上测试 SysConfig 代码的 mcu.c。 我认为它不会与 FR 器件兼容、但您可以将它用作430 driverlib 的起点。

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /*
    * Include Generic Header Files Here
    */
    #include <stdint.h>
    #include <stdbool.h>
    #include "mcu.h"
    #include "driverlib.h"
    unsigned char transmitLength = 0;
    unsigned char transmitCount = 0;
    unsigned char *transmitBuffer;
    unsigned char receiveCount = 0;
    unsigned char *receiveBuffer;
    /********* MCU SPECIFIC I2C CODE STARTS HERE**********/
    void mcu_i2cInit(uint8_t busId) {
    //Stop WDT
    WDT_A_hold(WDT_A_BASE);
    //Set the internal pull-up resistors
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    感谢 James 和 Ren 的帮助。  

    我 尝试 通过示波器分析 SCL 和 SDA 总线的波形。 当我运行 msp430fr59xx_eusci_i2c_standard_master.c 时、我会得到一个非常奇怪的波形  我已附加下图。 我将 LaunchPad 与 MSP430FR5969配合使用并连接到 TMP117 (从器件地址0*048)。 我使用了10K 上拉电阻器。  

    当我运行代码时、编译、加载和初始化成功进行、但在不同的位置停止并给出消息、例如  MSP430-Debug Call Stack。 如何解决此 问题。  

    在以下函数中也会出现相同的调试问题:

    堆栈大小:

    但是、如果我从资源浏览器中运行 eusci_b_i2c_ex2_masterRxSingle.c、我得到了以下波形、而没有任何调试问题、这些问题看起来是相同的。  

    非常感谢

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

    我建议您浏览 I2C Academy and Solutions to Common eUSCI and USCI Serial Communication Issues on MSP430 MCU (我之前链接过这些问题)。

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3740991 #3740991"]我使用了10K 上拉电阻器[/quot]

    这有点高。 我建议将其降低至4.7K 或更低、尤其是在通信速度超过100kHz 且使用为 I2C 线路添加电容的跳线时。

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3740991 #3740991"]当我运行 msp430fr59xx_eusci_i2c_standard_master.c.时、我会得到一个非常奇怪的波形。

    感谢您介绍您使用的示例。 此示例是寄存器级代码、I2C 时钟速度为100kHz。

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3740991 #3740991"]当我运行代码时、编译、加载和初始化会成功执行、但会在不同位置停止并显示消息、例如  MSP430-Debug Call Stack。 如何解决此 问题。  [/报价]

    请记住、器件会在特定时间进入低功耗模式。 这并不是一个真正的问题。

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3740991 #3740991"]但是、如果我从资源浏览器运行 eusci_b_i2c_ex2_masterRxSingle.c、我得到了以下波形、而没有任何调试问题、这些问题看起来完全相同。  [/报价]

    此示例是库级代码、I2C 时钟速度为400kHz。

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

    尊敬的 James:

    感谢你的答复。 我已经按照 MSP430 I2C Academy 文章中所述的 I2C 主设备示例"msp430fr243x_eusci_i2c_standard_master.c"进行了操作、并相应地修改了 TMP117的 msp430fr59xx_eusci_i2c_standard_master.c。 它们还将 SMCLK 设置为100kHz、但得到正确的波形。 我不知道我为什么会得到错误的波形。 要获得正确的波形、我需要做什么?

    非常感谢

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

    尊敬的 James:  

    我将 delay 函数的值从 1600000更改为2000毫秒、现在得到以下波形:

    以下是修改后的代码:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //******************************************************************************
    // MSP430FR59xx Demo - eUSCI_B0, I2C Master multiple byte TX/RX
    //
    // Description: I2C master communicates to I2C slave sending and receiving
    // 3 different messages of different length. I2C master will enter LPM0 mode
    // while waiting for the messages to be sent/receiving using I2C interrupt.
    // ACLK = NA, MCLK = SMCLK = DCO 16MHz.
    //
    // /|\ /|\
    // MSP430FR5969 4.7k |
    // ----------------- | 4.7k
    // /|\ | P1.7|---+---|-- I2C Clock (UCB0SCL)
    // | | | |
    // ---|RST P1.6|-------+-- I2C Data (UCB0SDA)
    // | |
    // | |
    // | |
    // | |
    // | |
    // | |
    //
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

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

    很棒!

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

    任您好、  

    我已尝试修改您的 MSP430FR5969 MCU 代码。 但是、我无法从传感器获取任何数据。 我正在尝试读取 TM117温度传感器、该传感器具有以下规格。

    TMP117传感器地址= 0x48                                                                                          温度寄存器=  0x00
    配置寄存器=  0x01                                                                                            TMP117分辨率0.0078125f  

    我不知道如何正确修改代码中的读取函数以从传感器获取数据。  请根据 TM117传感器规格帮助修改写入和读取函数。

    这是修改后的代码。

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    #include <msp430.h>
    #include "driverlib.h"
    #include <stdint.h>
    #include <stdbool.h>
    #include "mcu.h"
    unsigned char transmitLength = 0;
    unsigned char transmitCount = 0;
    unsigned char *transmitBuffer;
    unsigned char receiveCount = 0;
    unsigned char *receiveBuffer;
    #define SLAVE_ADDR 0x48 // sensor address
    #define TMP117_TEMP_REG 0x00 //temperature register
    #define TMP117_CONFIG_REG 0x01 //Configuration registry
    #define TMP117_RESOLUTION 0.0078125f // sensor resolution
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    非常感谢。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3746816 #3746816">我已经尝试修改您的 MSP430FR5969 MCU 代码。 但是、我无法从传感器获取任何数据。 我正在尝试读取 TM117温度传感器、它具有以下规格。[/quot]

    您是否参考了 TMP117数据表中提供的写入和读取时序图?   数据表中的第7.5.3.1.3节"写入和读取操作"也应该有所帮助。 您的命令与这些命令相比如何? TMP117是发送 ACK 还是 NACK? 通信在哪里停止正常工作?

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

    尊敬的 James:

    感谢你的答复。

    我尝试使用 I2C 函数来修改 mcu.c 文件、以便可以使用 TM117.h 库读取温度值。 建议的代码 REN 与 msp430fr59xx_eusci_i2c_standard_master.c 稍有不同

    [引用 userid="216616" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3747319 #3747319"]您是否引用了 TMP117数据表中提供的写入和读取时序图?

    没错。 我不确定如何正确修改 REN 建议的 mcu.c 文件中的写入和读取命令。 我在  msp430fr59xx_eusci_i2c_standard_master.c 中使用了以下读取和写入函数来读取 TM117温度寄存器、该寄存器工作正常。  

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    int main(void) {
    WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
    initClockTo16MHz();
    initGPIO();
    initI2C();
    //I2C_Master_WriteReg(SLAVE_ADDR, CMD_TYPE_0_MASTER, MasterType0, TYPE_0_LENGTH);
    I2C_Master_WriteReg(SLAVE_ADDR, 0x01, MasterType1, TYPE_1_LENGTH);
    while(1)
    {
    _delay_cycles(500000);
    // _delay_cycles(1600);
    I2C_Master_ReadReg(SLAVE_ADDR, 0x00, TYPE_1_LENGTH);
    CopyArray(ReceiveBuffer, SlaveType1, TYPE_1_LENGTH);
    if(ReceiveBuffer[1] & CONVERSION_READY)
    {
    I2C_Master_ReadReg(SLAVE_ADDR, 0x00, TYPE_1_LENGTH);
    CopyArray(ReceiveBuffer, SlaveType1, TYPE_1_LENGTH);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    [引用 userid="216616" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3747319 #3747319"] TMP117是发送 ACK 还是 NACK?

    这就是我得到的结果:

    [引用 userid="216616" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3747319 #3747319"]通信在哪里停止正常工作?

    当我暂停调试时、代码卡在 EUSCI_B_I2C 文件中、如下所示、因此它永远不会完成执行。 只需明确四个文件:(1) main.c、(ii) mcu.c、(iii) mcu.h (iv) tmp117.c 和(v) tmp117.h

    非常感谢

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3748651 #3748651"]没错。 我不确定如何正确修改 REN 建议的 mcu.c 文件中的写入和读取命令。 我在  msp430fr59xx_eusci_i2c_standard_master.c 中使用了以下读取和写入函数来读取 TM117温度寄存器、该寄存器工作正常。  [/报价]

    您可能需要重新组织一些写入和读取函数来实现这一点。 例如、TMP117传感器的"读取"命令可能仍需要在读取数据之前进行写入。

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3748651 #3748651"]当我暂停调试时、代码卡在 EUSCI_B_I2C 文件中、如下所示、因此从未完成执行。

    这可能是因为您使用的是最初用于 F5xx 器件的代码、而您使用的是 FR59xx 器件。 您可能需要通读  从 MSP430F5xx 和 MSP430F6xx 系列迁移到 MSP430FR58xx/FR59xx/68xx/69xx 系列 》应用手册的"增强型通用串行通信接口"部分。 此外、我还将查看 FR59xx 用户指南、详细了解在禁用中断并发送启动条件后为什么 TXIFG 未被置位。

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

    尊敬的 James:

    但愿你一切顺利。 我正在尝试使用  UART 接口在外部终端(我使用了 PuTTY)上打印字符串。 我已经修改 了 msp430fr59xx_euscia0_UART_03.c 来传输整数、如56。 我希望可以使用 UART 接口在终端上打印温度值。

    这是 msp430fr59xx_euscia0_UART_03.c 的修改代码:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    /* --COPYRIGHT--,BSD_EX
    * Copyright (c) 2012, Texas Instruments Incorporated
    * All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * * Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * * Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    * * Neither the name of Texas Instruments Incorporated nor the names of
    * its contributors may be used to endorse or promote products derived
    * from this software without specific prior written permission.
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
    * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    这就是我得到的结果:

    此示例代码仅适用于发送消息或整数、但不适用于浮点数字。  我在 sprintf 函数中使用了%f 而不是%d、并且还定义了浮点温度= 56.0123 、但我遇到了错误。 我想知道如何打印浮动号码? 例如56.0123。  

    Fullscreen
    1
    sprintf(stringTemp, "%d\n", temp);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    我还尝试合并这两个代码。 我在 msp430fr59xx_eusci_i2c_standard_master.c 中定义了一个名为"int UART()"的新函数、并从   msp430fr59xx_euscia0_UART_03.c 复制所有代码并粘贴到  "int UART()函数中。  然后 、我调用  了 msp430fr59xx_eusci_i2c_standard_master.c 主循环中的"int UART()"函数 这是组合代码:

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    //******************************************************************************
    // MSP430FR59xx Demo - eUSCI_B0, I2C Master multiple byte TX/RX
    //
    // Description: I2C master communicates to I2C slave sending and receiving
    // 3 different messages of different length. I2C master will enter LPM0 mode
    // while waiting for the messages to be sent/receiving using I2C interrupt.
    // ACLK = NA, MCLK = SMCLK = DCO 16MHz.
    //
    // /|\ /|\
    // MSP430FR5969 4.7k |
    // ----------------- | 4.7k
    // /|\ | P1.7|---+---|-- I2C Clock (UCB0SCL)
    // | | | |
    // ---|RST P1.6|-------+-- I2C Data (UCB0SDA)
    // | |
    // | |
    // | |
    // | |
    // | |
    // | |
    //
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    这就是我得到的结果:

    我想知道如何组合 msp430fr59xx_euscia0_UART_03.c 和 msp430fr59xx_eusci_i2c_standard_master.c、以便我可以通过 I2C 从传感器获取数据并使用 printf ()函数将其打印到外部终端。

    如果您有任何问题、请告诉我、非常感谢。

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

    您好、Irfan、

    [引用 userid="489949" URL"~/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1011454/msp430fr5969-i2c-sample-code-for-the-msp430fr5969-microcontroller-to-communicate-with-the-tmp117-temperature-sensor/3753053 #3753053"]我想知道如何组合 msp430fr59xx_euscia0_UART_03.c 和 msp430fr59xx_eusci_i2c_standard_master.c、以便我可以通过 I2C 获取传感器的数据并使用外部函数 printf[]。

    这超出了原始问题的范围、因此如果您继续遇到 UART 问题、我建议您创建一个新的线程。 我不建议使用浮点值、而是将整数向上缩放(例如10.234 > 10234)。 假设示例使用不同的模块、合并这些示例不应太困难。 由于开销增加,我倾向于不使用 print()或 sprint(),但使用 了此处所述的 printf()的较轻版本