Cypress技术论坛
直播中

毛微

7年用户 216经验值
私信 关注
[问答]

过滤器组件如何使用?

大家好,
我们如何着手使用新的过滤器组件?我想尝试新的过滤器组件如下:
1)12位数据输入
2)基本汉明窗FIR低通滤波器
12位样本数据概念代码:
/全局变量
It16数据[128 ]={…};/ /我将从另一个程序导入的一些输入值数组
It16输出(256);/ /空数组,它将保持滤波器的输出(大到足以解释由于卷积而增大的大小)
主回路UIT16 I;/计数器
空主程序()
{
筛选器启动();
(i=0;i,lt;128;i++)
{
FieldWrute16(数据);
CyDelay(1);
输出=FieldRead 16();
}
//完成后将数据打印到测试终端
}
这是正确使用过滤器的方法吗?如何选择ReXxx()函数?Read 24()函数能给我最高的精度吗?或者Read 16()是否足够恰当?
谢谢!

以上来自于百度翻译


     以下为原文
   Hi Everyone,
    How do we go about using the new filter component? I would like to try the new filter component as follows:
    1) 12 bit data input
    2) Basic Hamming window FIR lowpass filter
    12 bit sample data conceptual code:
    //Global variables
    int16 data[128] = {...};//Some array of input values that I will import from another program
    int16 output[256];//Empty array that will hold the filter's output (big enough to account for size increase due to convolution)
    uint16 i;//Counter for main loop
    void main()
    {

         Filter_Start();
         for(i = 0; i < 128; i++)
         {
              Filter_Write16(data);
              CyDelay(1);//Be sure that filter has finished its operation
              output = Filter_Read16();
         }

    //Print the data to the test terminal upon completion
    }
    Is this the right way to go about using the filter? How do I choose the Readxx() function? Does the Read24() function give me the highest precision? Or will the Read16() be sufficent and scale properly?
    Thanks!

回帖(2)

魏霖

2019-4-16 15:31:59
我也对此深感兴趣。我想你可能需要设置一致性寄存器第一。

以上来自于百度翻译


     以下为原文
   I'm intrested in this too. I think you might have to set the coherency register 1st. Unfortunatley, all of the code examples for this are down right now.
举报

魏霖

2019-4-16 15:42:50
我用这个代码做了一次尝试,看起来效果不错。
对于(i=0;i & lt;inlln;i++)
{
/过滤材料
FieldHythRead 16(FieldChhanelyA,输入);
CyDelay(1);
输出=FieldRead 16(Fiter);
/取滤波器输出并通过USB打印到终端
Simulf(缓冲器,“%d”,输出);
UARTH字符串(缓冲器);
}

以上来自于百度翻译


     以下为原文
   I gave it a try with this code, and it seemed to work pretty well.
     
     
    for(i = 0; i < IN_LEN; i++)
     {
     //Filter stuff
     Filter_Write16(Filter_CHANNEL_A, input);
     CyDelay(1);
     output = Filter_Read16(Filter_CHANNEL_A);
      
     //Take the filter's output and print to terminal via USB
     sprintf(buffer, "%d,", output);
     UART_PutString(buffer);
     }
            
举报

更多回帖

×
20
完善资料,
赚取积分