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.

[参考译文] MSP430FR2311:MSP430FR2311上的 SRQT (x)

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1450462/msp430fr2311-srqt-x-on-msp430fr2311

器件型号:MSP430FR2311

工具与软件:

我想在 MSP430FR2311上使用 SQRT (x)平方根、因此添加了#include 写入我的程序、但它无法正常工作。
您是否知道如何实现 sqrt (16位数据)? 如果您有任何好的方法、我将非常感谢您的建议。

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

    您好!

    您能解释一下它为什么不起作用吗?

    您的意思是无法编译?

    此致、

    Zoey

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

    "16位数据"一词具体是什么意思?

    不过,我也有同样的问题。

    这将编译:

    #include <msp430.h>
    
    #include <stdint.h>
    
    #include <stdlib.h>
    #include <math.h>
    
    int main(void)
    {
       double x, y;
    
        WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer
    
    
        P1OUT &= ~BIT0;                         // Clear P1.0 output latch for a defined power-on state
        P1DIR = 0xFF;                          // Set P1.0 to output direction
    
        PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                                // to activate previously configured port settings
    
        x = 4.0;
        //y = sqrt(x);
    
    
        while(1)
        {
            P1OUT &= ~BIT0;
    
            __delay_cycles(100000);
    
        }
    }

    这不会:

    #include <msp430.h>
    
    #include <stdint.h>
    
    #include <stdlib.h>
    #include <math.h>
    
    int main(void)
    {
       double x, y;
    
        WDTCTL = WDTPW | WDTHOLD;               // Stop watchdog timer
    
    
        P1OUT &= ~BIT0;                         // Clear P1.0 output latch for a defined power-on state
        P1DIR = 0xFF;                          // Set P1.0 to output direction
    
        PM5CTL0 &= ~LOCKLPM5;                   // Disable the GPIO power-on default high-impedance mode
                                                // to activate previously configured port settings
    
        x = 4.0;
        y = sqrt(x);
    
    
        while(1)
        {
            P1OUT &= ~BIT0;
    
            __delay_cycles(100000);
    
        }
    }

    这是错误:

    ">编译失败
    Makefile:135:目标'm 44430fr231x_1.c.out'的配方失败
    "../lnk_msp430fr2311.cmd"、第133行:错误#10099-D:程序无法装入可用内存、或者该段包含一个调用站点、该调用站点需要无法为此段生成 trampoline。 针对"ALL_FRAM"段大小0x12c4的对齐放置失败。  可用存储器范围:
      FRAM        大小:0xe80       未使用:0xe80       最大空洞:0xe80     
    错误#10010:链接过程中遇到错误;未构建"msp430fr231x_1.c.out"
    gmake[1]:***[msp430fr231x_1.c.out]错误1.
    Makefile:131:目标"全部"的配方失败"

    添加对 sqrt()的引用使代码过大。

    将 sqrt ()更改为 sin ()允许编译。

    CCS:版本:12.8.1.00005  

    编译器:TI v21.6.0.LTS