学习《Simulink仿真及代码生成技术》
使用固定点数据类型配置的模型生成的代码相对于浮点数据类型占用较少的内存空间,并能够以更快的速度执行,对于嵌入式产品的开发很有帮助,一方面提高计算性能,一方面节约硬件成本,毕竟带有浮点运算单元FPU的MCU和DSP价钱较高,在嵌入式产品价格竞争中,些许的成本差距就可以拉开市场占有率的差距。
FPU:Floating Point Unit是CPU中浮点运算单元的简称。
DSP:数字信号处理器(Digital Signal Processor, DSP)是用来高速处理数字信号的专用芯片。
固定点数据格式:
指二进制数据
1.符号
2.字长
3.表示小数的数据位
例子:将数字-2.75表示为一个有符号,字长为8,小数部分使用3位的数据。这个数据类型就可以描述为fixdt(1,8,3)。
按书上操作是可以转换的。
我想试试其他数,于是把-2.75改成了-50,报下面错:
Error calling slsfnagctlr('ClearSimulation',...)
Invalid or deleted object.
Parameter overflow occurred for 'Value' of 'self/Constant'. The parameter's value is outside the range that the run-time data type can represent. The specified value was saturated to the closest representable value. To disable this warning or error, in the Configuration Parameters > Diagnostics > Data Validity pane, set the 'Detect overflow' option in the Parameters group to 'none'.
Component: Simulink | Category: Block error
原因待分析。