请问STC32F系列单片机能不能代替DSP作高阶数字滤波?
看了STC32F系列的单片机介绍,这款芯片主频高,有32位硬件乘除单元和单精度浮点运算单元,看起来性能不错.
不知道跑高阶窄带数字滤波的话,中心频率最高能做到多少?
下面是用滤波器工具生成的一段滤波代码,
哪位大佬能不能测试下用STC32F测试下运行速度.
float DigFil(invar, setic)
float invar; int setic;
/******************************************************************************/
/* Filter Solutions Version 2015 Nuhertz Technologies, L.L.C. */
/* www.nuhertz.com */
/* +1 602-279-2448 */
/* 20th Order Band Pass Butterworth */
/* Matched Z Transformation */
/* Sample Frequency = 300.0 KHz */
/* Standard Form */
/* Arithmetic Precision = 4 Digits */
/* */
/* Center Frequency = 100.0 KHz */
/* Pass Band Width = 2.700 KHz */
/* Pass Band Attenuation = 1.2 dB */
/* */
/******************************************************************************/
/* */
/* Input Variable Definitions: */
/* Inputs: */
/* invar float The input to the filter */
/* setic int 1 to initialize the filter to zero */
/* */
/* Option Selections: */
/* Standard C; Initializable; Internal States; Optimized; */
/* */
/* There is no requirement to ever initialize the filter. */
/* The default initialization is zero when the filter is first called */
/* */
/******************************************************************************/
/* */
/* This software is automatically generated by Filter Solutions */
/* no restrictions from Nuhertz Technologies, L.L.C. regarding the use and */
/* distributions of this software. */
/* */
/******************************************************************************/
{
float sumnum=0.0, sumden=0.0;int i=0;
static float states = {0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
static float znum = {
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.304e-31
};
static float zden = {
.4763,
9.703,
103.8,
765.0,
4334.0,
2.e+04,
7.79e+04,
2.624e+05,
7.778e+05,
2.055e+06,
4.885e+06,
1.053e+07,
2.071e+07,
3.736e+07,
6.201e+07,
9.504e+07,
1.348e+08,
1.773e+08,
2.166e+08,
2.46e+08,
2.598e+08,
2.553e+08,
2.333e+08,
1.982e+08,
1.564e+08,
1.144e+08,
7.746e+07,
4.843e+07,
2.787e+07,
1.47e+07,
7.077e+06,
3.089e+06,
1.214e+06,
4.25e+05,
1.309e+05,
3.488e+04,
7845.0,
1437.0,
202.3,
19.63
};
if (setic==1){
for (i=0;i<40;i++) states = 4.156e-10*invar;
return 0.0;
}
else{
sumnum = sumden = 0.0;
for (i=0;i<40;i++){
sumden += states*zden;
sumnum += states*znum;
if (i<39) states = states;
}
states = invar-sumden;
sumnum += states*znum;
return sumnum;
}
}
应该可以,你可以用官方工具测试一下 马上 STC8051H 出来了,TFPU 是 108MHz
DSP是有很多物理计算单元的,很多复杂计算只需要很少的几条指令即可完成,这是单片机无法替代的,术业有专攻,这也是为什么很多MCU开始集成DSP运算单元,很多DSP也开始内置MCU小核,之所以向异构核心发展,就是因为彼此都不能替代。 术业有专攻吧 数字滤波器就是执行乘加运算,STC32F执行一次32位有符号整数乘加运算大约为0.5us @30MHz,二阶数字滤波执行5次乘加运算,即大约2.5us/二阶,比如计算8阶滤波就是10us。 只要单片机足够快!软件算法是可以实现数字滤波器的!但是现在有硬件dsp了!即使是168mhz速度也是可以计算fir和iir滤波器!而且同时驱动显示器 bi4slj 发表于 2024-4-20 16:07
只要单片机足够快!软件算法是可以实现数字滤波器的!但是现在有硬件dsp了!即使是168mhz速度也是可以计算f ...
对对对
页:
[1]