




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、郑州航空工业管理学院电子通信工程系dsp原理及应用课程设计报告设计题目:基于tms320f2812 dsp处理器的信号仪的设计与实现一、 引言二、设计目的1、编写串行外设接口spi的驱动程序;2、了解数模转换的基本操作,设计基于数模转换芯片ad7303的正弦信号发生电路;3、编写tms320f2812利用spi接口驱动ad7303输出正弦信号波形的应用程序。三、设计要求四、总体设计4.1硬件部分4.1.1数模转换操作的应用基础利用专用的数模转换芯片,可以实现将数字信号转换成模拟量输出的功能。在expiv型实验箱上,使用的是ad7303数模芯片,它可以实现同时转换2路模拟信号数出,并有8位精度,
2、da转换时间1.2s。其控制方式较为简单:首先将需要转换的数值及控制指令同时通过spi总线传送到ad7303上相应寄存器,经过一个时间延迟,转换后的模拟量就从ad7303输出引脚输出。4.1.2 ad7303简介ad7303是一款双通道、8位电压输出dac,采用+2.7 v至+5.5 v单电源供电。它内置片内精密输出缓冲,能够实现轨到轨输出摆幅。这款器件采用多功能三线式串行接口,能够以最高30mhz的时钟速率工作,并与qspi、spi、microwire以及数字信号处理器接口标准兼容。串行输入寄存器为16位,其中8位用作dac的数据位,其余8位组成一个控制寄存器。图1 数字量与输出模拟量换算表
3、图2 输入移位寄存器图3ad7303输入移位寄存器位定义及设置方式4.1.3 应用ad7303的dac电路设计图4 ad7303电路设计4.2 软件部分4.2.1 程序流程图处理器上电复位cpu及串行外设接口初始化产生128个点的正弦信号波形按ad7303输入移位寄存器的位定义,传输数据,进行数模转换双路波形输出4.2.2 在ccs集成开发环境下新建工程 4.2.3在simulator环境下观察信号的时域及fft magnitude波形4.2.4 程序清单;*/*- 文件信息 - ;* ;* 文件名称 : example_dsp281x_da.c ;* 适用平台 : dsp专家4实验箱;* c
4、pu类型 : dsp tms320f2812 ;* 软件环境 : ccs2.20 (2000系列);* 试验接线 : 1、f2812cpu板的jump1的2和3脚短接,jump2的1和2脚短接;;* 2、实验箱底板的开关k9拨到右侧,选择cpu2.;* 试验现象 : 设置好ccs的环境,打开本工程,编译、下载、运行。;* 利用示波器观察实验箱da单元的二号孔输出1有正弦波输出。;* 地址译码说明:基地址(0x80000) */ /*头文件*/#include dsp281x_device.h / dsp281x headerfile include file#include dsp281x_e
5、xamples.h / dsp281x examples include file#include math.h#define pi 3.1415926unsigned int curve128; unsigned int curve1128; unsigned int curve2128;/ prototype statements for functions found within this file./ interrupt void isrtimer2(void);void spi_init(void);/void spi_fifo_init(void);void delay(void
6、); void main(void) int i,p,data;/ step 1. initialize system control:/ pll, watchdog, enable peripheral clocks/ this example function is found in the dsp281x_sysctrl.c file. initsysctrl();/ step 2. initalize gpio: / this example function is found in the dsp281x_gpio.c file and/ illustrates how to set
7、 the gpio to its default state./ initgpio(); / skipped for this example / setup only the gp i/o only for spi functionality eallow; gpiomuxregs.gpfmux.all=0x000f;/ select gpios to be spi pins / port f mux - x000 0000 0000 1111 edis;/ step 3. clear all interrupts and initialize pie vector table:/ disa
8、ble cpu interrupts dint;/ initialize pie control registers to their default state./ the default state is all pie interrupts disabled and flags/ are cleared. / this function is found in the dsp281x_piectrl.c file. initpiectrl();/ disable cpu interrupts and clear all cpu interrupt flags: ier = 0x0000;
9、 ifr = 0x0000; / initialize the pie vector table with pointers to the shell interrupt / service routines (isr). / this will populate the entire table, even if the interrupt/ is not used in this example. this is useful for debug purposes./ the shell isr routines are found in dsp281x_defaultisr.c./ th
10、is function is found in dsp281x_pievect.c. initpievecttable();/ step 4. initialize all the device peripherals:/ this function is found in dsp281x_initperipherals.c/ initperipherals(); / not required for this example/ spi_fifo_init(); / initialize the spi fifo spi_init(); / init spi for(i=0; i128;i+)
11、 /*产生128个点的正弦信号波形*/ data=(int)(127.5*(1+sin(2*pi*i/127); curvei=data; /*将数据打包成“从移位寄存器到dac a数据寄存器*/ curve1i=data&0x00ff|0x0100; /*将数据打包成“从移位寄存器到dac b数据寄存器 且用数据寄存器同时更新a和b两个da的值*/ curve2i=data&0x00ff|0x2500; for(;) for(p=0;p128;p+) /*将数据写入ad7303*/ spiaregs.spitxbuf=curve1p; delay(); /*将数据写入ad7303*/ spi
12、aregs.spitxbuf=curve2p; delay(); void spi_init() spiaregs.spiccr.bit.spiswreset=0; / reset scispiaregs.spiccr.all =0x000f; / reset on, rising edge, 16-bit char bits spiaregs.spictl.all =0x000e; / enable master mode, normal phase, spiaregs.spists.all=0x0080; / enable talk, and spi int disabled.spiaregs.spibrr =0x0000; / baud rate; spiaregs.spipri.bit.free = 1; / set so breakpoints dont disturb xmission spiaregs.spiccr.bit.spiswreset=1; / enable spi void delay(void) /延时子程序 unsigned int k; for(k=0;k50;k+);4.3 调试部分4.3.1 硬件调试4.3.2 软件调试4.
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年财务管理部招聘面试实战模拟题及答案
- 国有银行笔试题库及答案
- 2025年政策法规解读与应对模拟题及答案面向公务员备考者
- 2025年草原监理员考试模拟题解析及答案
- 2025年建筑师执业资格考试全真模拟试题
- 2026届河南省荥阳市第二高级中学高一化学第一学期期中学业水平测试试题含解析
- 2025年高职院校财务招聘考试热点解析与备考建议
- 2025年造纸行业专业技能提升模拟题及答案
- 2025年国际贸易公司招聘笔试模拟试题及备考指南
- 2025年全面解析气象部门事业单位招聘考试内容与模拟题集合
- 综采工作面液压支架安装回撤工理论考核试题及答案
- 初中高中英语所有单词集合带音标
- 露天矿山危险源辨识(汇总)
- 放射科质控汇报
- GB/T 31091-2014煤场管理通用技术要求
- GB/T 24218.1-2009纺织品非织造布试验方法第1部分:单位面积质量的测定
- 万东GFS型高频高压发生装置维修手册
- 公寓de全人物攻略本为个人爱好而制成如需转载注明信息
- 企业经营沙盘模拟实训指导书
- 汉密尔顿抑郁量表17项
- 《现代物流管理》第一章-导论(课用)
评论
0/150
提交评论