请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430FR6007 大家好、
客户在测试 LEA 时有以下2个问题:
1. 客户使用 ADC 获得的结果并直接乘以 LEA、结果不正确:( 此处为完整代码)
void main(void) { msp_status status; msp_mpy_iq31_params mpyParams; msp_fft_iq31_params fftParams; // ----ADC Raw data ---------- _q15 test[SAMPLES] = {22, 23, 17, 12, 15, 15, 17, 27, 24, 17, 17, 22, 18, 24, 24, 19, 18, 23, 21, 16, 16, 16, 14, 16, 24, 21, 13, 18, 17, 0, 10, 68, 79, -16, -95, -12, 170, 163, -95, -235, 20, 333, 204, -241, -355, 77, 475, 244, -338, -452, 114, 598, 282, -437, -547, 145, 688, 325, -475, -624, 114, 747, 385, -510, -691, 112, 817, 445, -531, -748, 101, 855, 470, -539, -782, 79, 868, 500, -541, -813, 58, 885, 522, -545, -831, 60, 896, 533, -527, -808, 53, 845, 477, -496, -682, 104, 676, 292, -376, -414, 74, 366, 198, -85, -153, -53, 52, 121, 136, 31, -152, -177, 70, 318, 211, -184, -374, -38, 431, 386, -174, -513, -134, 485, 475, -180, -567, -136, 497, 468, -162, -503, -144, 381, 400, -57, -377, -171, 271, 369, 14, -307, -194, 176, 310, 71, -210, -173, 106, 249, 88, -144, -138, 68, 192, 81, -91, -108, 36, 135, 72, -42, -61, 22, 96, 70, -11, -42, 9, 69, 56, -4, -25, 11, 49, 46, 7, -15, 13, 49, 41, 16, 6, 12, 26, 26, 8, -4, 10, 33, 35, 17, 11, 23, 23, 23, 20, 11, 11, 20, 31, 24, 16, 22, 24, 23, 24, 14, 12, 16, 22, 25, 22, 18, 17, 25, 26, 20, 16, 16, 20, 17, 21, 22, 14, 10, 18, 24, 19, 15, 17, 16, 22, 37, 28, 17, 12, 16, 28, 28, 9, 3, 19, 30, 20, 12, 14, 20, 26, 29, 22, 6, 14, 30, 40, 20}; uint16_t i =0 ; /* Disable WDT */ WDTCTL = WDTPW + WDTHOLD; #ifdef __MSP430_HAS_PMM__ /* Disable GPIO power-on default high-impedance mode for FRAM devices */ PM5CTL0 &= ~LOCKLPM5; #endif /* Initialize input signal and Hamming window */ // initSignal(); // initHamming(); //--------The ADC raw value is assigned to input here . for(i = 0; i < SAMPLES;i++){ input[i] = test[i]; window[i] = 2; } /* Multiply input signal by generated Hamming window */ mpyParams.length = SAMPLES; //--------First multiply the original ADC value by 2, and the result here is not right status = msp_mpy_iq31(&mpyParams, input, window, input); msp_checkStatus(status); //--------------Because the previous calculation is incorrect, does the FFT have any meaning here? /* Initialize the fft parameter structure. */ fftParams.length = SAMPLES; fftParams.bitReverse = 1; fftParams.twiddleTable = msp_cmplx_twiddle_table_256_q15; /* Perform real FFT with no scaling */ msp_benchmarkStart(MSP_BENCHMARK_BASE, 64); status = msp_fft_iq31(&fftParams, input); cycleCount = msp_benchmarkStop(MSP_BENCHMARK_BASE); msp_checkStatus(status); /* End of program. */ __no_operation(); }
如果需要转换以使用、如何将 ADC 采集的结果 int integer data LEA 相乘? 如果使用运算转换、则此转换非常耗时。 是否可以提供相关的应用案例供参考?
您可以帮助解决此问题吗? 谢谢!
此致、
樱桃