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.

[参考译文] MSP430FR2355:数组查找/拟合--如何?

Guru**** 2538930 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/954658/msp430fr2355-array-lookup-fit----how-to

器件型号:MSP430FR2355

您好...

我有以下内容:

const int lookup[]={0、53、72、84、100、 125、143、167、215、222、 250、300、334、\
358、375、400、429、438、 500、572、600、625、643、 667、700、\
715、750、786、800、833、 846、857、875、900、917、 929};
const int reg_setting[]={0x0、0x1、0x2、0x4、0x8、 0x10、0x20、0x11、0x21、0x22、 \
0x44、0x25、0x49、0x4A、0x52、 0x92、0x53、0x55、0xAA、\
0x6B、0xAD、0xB5、0xB6、0xD6、 0xB7、0xBB、0xDD、0xED、\
0xEE、0xBF、0xDF、0xEF、0xF7、 0xFB、0xFD、0xFE};

我想知道有没有人可以告诉我 C 语言中的最佳方法来处理以下问题?  我有一个创建整数的数学函数。  然后、我要将整数与查找数组进行比较、使整数<= array[value]。  然后、该值将成为 REG_Setting 数组的索引、并将使用该值。

谢谢