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.

[参考译文] MSP430F5418A:是否有用于控制 LP5036 LED 驱动器的代码?

Guru**** 2538950 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/924189/msp430f5418a-is-there-code-for-controlling-the-lp5036-led-driver

器件型号:MSP430F5418A

我知道这是一个简单的 I2C 代码-但我想知道是否有任何示例?

谢谢、

梅希

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

    您好、Mechi、

    很抱歉,我们没有您需要的示例,我们只提供了一些 I2C 示例代码供您参考:

    https://dev.ti.com/tirex/explore/node?node=AO-GzKi3iE5i6eQjp3ACig__IOGqZri__LATEST

    此致

    Johnson

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

    我实际上在寻找不使用中断处理程序的代码。 所有示例都使用中断处理程序。

    此外、我需要 UCB1的代码-尽管我可以轻松地对其进行调整...

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

    我需要无中断的代码-  

    与 MSP430 DevWare 中的代码类似:

    bool USCI_B_I2C_masterSendMultiByteFinishWithTimeout (uint16_t baseAddress、
    uint8_t txData、
    uint32_t 超时)
    {
    uint32_t timeout2 =超时;
    
    //如果未使用中断,则轮询标志
    if (!(HWREG8 (baseAddress + OFS_UCBxIE)& UCTXIE))
    {
    //轮询发送中断标志。
    while ((!(HWREG8 (baseAddress + OFS_UCBxIFG)& UCTXIFG))&&-超时)
    {
    ;
    }
    
    //检查传输是否超时
    if (超时=0)
    {
    返回(status_fail);
    }
    }
    
    //发送单字节数据。
    HWREG8 (baseAddress + OFS_UCBxTXBUF)= txData;
    
    //轮询发送中断标志。
    while ((!(HWREG8 (baseAddress + OFS_UCBxIFG)& UCTXIFG))&-timeout2)
    {
    ;
    }
    
    //检查传输是否超时
    if (timeout2 = 0)
    {
    返回(status_fail);
    }
    
    //发送停止条件。
    HWREG8 (baseAddress + OFS_UCBxCTL1)|= UCTXSTP;
    
    return (status_Success);
    }
    

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

    您好、Mechi、

    很抱歉稍后回复您、对于 I2C 示例代码、您可以参阅此链接、也可以尝试使用寄存器级别:

    https://dev.ti.com/tirex/explore/node?node=AAlYA4O0NtpJRj5pWT3-Ow__IOGqZri__LATEST

    此致

    Johnson