问答

汇集网友智慧,解决技术难题

21ic问答首页 - DSP28335编程问题:正弦波查找表中相位值不更新

更新 相位 DSP28335 正弦波 编程 DSP

DSP28335编程问题:正弦波查找表中相位值不更新

demons1232024-04-24
*
* main.c
*
*  Created on: 2023年10月30日
*      Author: DELL
*/

#include "DSP2833x_Device.h"     // DSP2833x Headerfile Include File
#include "DSP2833x_Examples.h"   // DSP2833x Examples Include File
#define TABLE_SIZE 128 // 查找表的大小
#define TABLE_SCALE 32767 // 查找表的缩放因子
typedef unsigned long ulong;
float b;
float c;
float phase=20;
float sin=0;
int sin_table[TABLE_SIZE] = {
0, 1608, 3212, 4808, 6393, 7962, 9512, 11039, 12539, 14010,
15446, 16846, 18204, 19519, 20787, 22005, 23170, 24279, 25329,
26319, 27245, 28105, 28898, 29621, 30273, 30852, 31356, 31785,
32137, 32412, 32609, 32728, 32767, 32728, 32609, 32412, 32137, 31785,
31356, 30852, 30273, 29621, 28898, 28105, 27245, 26319, 25329, 24279,
23170, 22005, 20787, 19519, 18204, 16846, 15446, 14010, 12539, 11039, 9512,
7962, 6393, 4808, 3212, 1608,0, -1608, -3212, -4808, -6393, -7962, -9512, -11039,
-12539, -14010, -15446, -16846, -18204, -19519, -20787, -22005, -23170,
-24279, -25329, -26319, -27245, -28105, -28898, -29621, -30273, -30852, -31356,
-31785, -32137, -32412, -32609, -32728, -32767, -32728, -32609, -32412, -32137, -31785,
-31356, -30852, -30273, -29621, -28898, -28105, -27245, -26319, -25329, -24279, -23170, -22005, -20787, -19519,
-18204, -16846, -15446, -14010, -12539, -11039, -9512, -7962, -6393, -4808, -3212, -1608
};
void main()
{
      while(1)
         {int a=phase;
          sin=sin_table[a] ;

          }
}
各位,问大家个问题。我用ccs的watch expression功能在线修改phase得值时,sin值并不会随着改变。哪里有问题吗?
回答 +关注 0
897人浏览 0人回答问题 分享 举报
0 个回答

您需要登录后才可以回复 登录 | 注册