DSP C5400软件设计基础
- 格式:ppt
- 大小:1.20 MB
- 文档页数:58
DSP的C语言程序设计一、为什么要使用C语言对DSP编程C语言是高级语言,易学易用。
C语言的编程效率极高,易于调试。
C语言的可移植性好。
二、C程序的结构及组成完整的C程序是由一个主函数main()和其它的子函数组成的,每一个子函数完成特定的功能。
DSP的C 语言的入口地址固定为c_int00,在中定义。
C语言支持丰富的数据类型和数据结构,在ccs集成开发环境中,为C语言提供了完整的支持硬件的底层函数库和支持算法的DSP函数库。
在使用C语言的库函数时,在工程中必须包括相应的函数库和运行时支持库。
下面是一般C语言程序的结构和组成框架。
一般C程序的结构如下:h头文件#include “函数库1”#include <函数库2>#include “函数库3”…*//* *//* Parameters: *//* - port - port address (HEX) *//* *//* Return: *//* - returns value read from port. *//* *//* Notes: *//* *//*****************************************************************************/s16 portRead(u16 port);/*****************************************************************************//* portWrite(u16 port, s16 value) *//* *//* This routine writes a word to the specified port. */ /* *//* Parameters: *//* - port - port address (HEX) *//* - value - 16 bit word to write. *//* *//* Return: *//* - none *//* *//* Notes: *//* *//*****************************************************************************/void portWrite(u16 port, s16 value);#endif /* end of #ifndef _PORTIO_H */使用时,先使用宏替换或枚举定义I/O端口的地址,然后使用portRead()和portWrite()函数访问I/O端口例如:#includeVariable=portRead(portA);c5400\cgtools\include目录与c5400\dsk5402\include目录中的头文件类型不同。