实验报告集合(程序)心得体会_第1页
实验报告集合(程序)心得体会_第2页
实验报告集合(程序)心得体会_第3页
实验报告集合(程序)心得体会_第4页
实验报告集合(程序)心得体会_第5页
已阅读5页,还剩24页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、三、实验原理浮点数的表达和计算是进行数字信号处理的基本知识;产生正弦信号是数字信号处理中经常用到的运算;C语言是现代数字信号处理表达的基础语言和通用语言。写实现程序时需要注意两点:(1)浮点数的范围及存储格式;(2)DSP的C语言与ANSI C语言的区别。四、实验步骤1.打开CCS 并熟悉其界面;2.在CCS环境中打开本实验的工程(Example_base.pjt),编译并重建 .out 输出文件,然后通过仿真器把执行代码下载到DSP芯片中;3 把X0 , Y0 和Z0添加到Watch窗口中作为观察对象(选中变量名,单击鼠标右键,在弹出菜单中选择“Add Watch Window”命令);4

2、选择view-graph-time/frequency。 设置对话框中的参数: 其中“Start Address”设为“sin_value”,“Acquisition buffer size”和“Display Data size”都设为“100”,并且把“DSP Data Type”设为“32-bit floating point”, 设置好后观察信号序列的波形(sin函数,如图);5 单击运行;6 观察三个变量从初始化到运算结束整个过程中的变化;观察正弦波形从初始化到运算结束整个过程中的变化;7 修改输入序列的长度或初始值,重复上述过程。五、实验心得体会通过本次实验,加深了我对DSP的认识

3、,使我对DSP实验的操作有了更进一步的理解。基本掌握了CCS实验环境的使用,并能够使用C语言进行简单的DSP程序设计。从软件的安装到使用软件进行程序设计与仿真,锻炼了自己的动手能力,也遇到了不少的坎坷,例如芯片的选择,不能因为麻烦而省略该步骤,否则将会运行出错。附录实验程序:#include math.h#include stdio.h#define N 100#define pi 3.14159float sin_value100;float X0,Y0,Z0;void main(void) int i; for(i=0;iN;i+) sin_valuei=0; X0=0.5; /* 0.1

4、00 0000 0000 0000 */ Y0=0.5; /* 0.100 0000 0000 0000 */ Z0=X0*Y0; /* 00.01 0000 0000 0000 0000 0000 0000 0000 */ for(i=0;iN;i+) sin_valuei=100*(sin(2*pi*i/N);龙 岩 学 院实 验 报 告班 级 07电本(1)班 学号 姓 名 杨宝辉 同组人 独立 实验日期 2010-5-20 室温 大气压 成 绩 数码管控制实验一、实验目的1. 熟悉2812的指令系统;2.熟悉74HC573的使用方法。3.熟悉DSP的IO操作使用方法。二、实验设备1.一

5、台装有CCS2000软件的计算机;2.插上2812主控板的DSP实验箱;3.DSP硬件仿真器。三、实验原理此模块由数码管和四个锁存器组成 。数码管为共阴极型的。数据由2812模块的低八位输入,锁存器的控制信号由2812模块输出,但经由CPLD模块译码后再控制对应的八个四、实验步骤1.把2812模块小板插到大板上;2. 在CCS2000环境中打开本实验的工程编译Example_7segled.prj,生成输出文件,通过仿真器把执行代码下载到DSP芯片;3. 运行程序;数码管会显示18的数字。 4. 参考源代码自行修改程序改变显示样式。 五、实验心得体会通过本次实验中,基本掌握了2812的指令系统

6、的特点,并能够了解并熟悉74HC573的使用方法,进一步加深了对DSP的认识。同时,通过实验操作DSP的IO操作使用方法,对于DSP的IO操作可以熟悉的运用,学到更多的知识。程序见附录:#include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void delay_lo

7、op(void);void Gpio_select(void);/ Global variable for this exampleshort codetab17=0x4020,0x6cc0,0x5800,0x4840,0x6440,0xC040,0xC000,0x4cc0,0x4000,0x4040,0x4400,0xE000,0xD080,0xE800,0xD000,0xD400,0xffff;main() short i; / Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This

8、 example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl(); / Specific clock setting for this example: EALLOW; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for

9、 this example/ For this example use the following configuration: Gpio_select();/ Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are

10、cleared. / This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000;/ Initialize the PIE vector table with pointers to the shell Interrupt / Service Routines (ISR). / This will populate the entire table

11、, 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./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_Ini

12、tPeripherals.c/ InitPeripherals(); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: GpioDataRegs.GPADAT.all=0; Reg01=0x00; GpioDataRegs.GPADAT.all=0; Reg02=0x00; GpioDataRegs.GPADAT.all=0; Reg03=0x00; GpioDataRegs.GPADAT.

13、all=0; Reg04=0x00; while(1) for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg01=0x00; delay_loop(); for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg02=0x00; delay_loop(); for(i=0;i17;i+) GpioDataRegs.GPADAT.all =codetabi; Reg03=0x00; delay_loop(); for(i=0;i17;i+) GpioDataRegs.GPADAT.all =

14、codetabi; Reg04=0x00; delay_loop(); void delay_loop() short i,j; for (i = 0; i 32767; i+) for (j = 0; j 10; j+);void Gpio_select(void) Uint16 var1; Uint16 var2; Uint16 var3; var1= 0x0000;/ sets GPIO Muxs as I/Os var2= 0xFFFF;/ sets GPIO DIR as outputs var3= 0x0000;/ sets the Input qualifier values E

15、ALLOW;GpioMuxRegs.GPAMUX.all=var1; GpioMuxRegs.GPBMUX.all=var1; GpioMuxRegs.GPDMUX.all=var1; GpioMuxRegs.GPFMUX.all=var1; GpioMuxRegs.GPEMUX.all=var1; GpioMuxRegs.GPGMUX.all=var1; GpioMuxRegs.GPADIR.all=var2;/ GPIO PORTs as output GpioMuxRegs.GPBDIR.all=var2; / GPIO DIR select GPIOs as output GpioMu

16、xRegs.GPDDIR.all=var2; GpioMuxRegs.GPEDIR.all=var2; GpioMuxRegs.GPFDIR.all=var2; GpioMuxRegs.GPGDIR.all=var2; GpioMuxRegs.GPAQUAL.all=var3; / Set GPIO input qualifier values GpioMuxRegs.GPBQUAL.all=var3; GpioMuxRegs.GPDQUAL.all=var3; GpioMuxRegs.GPEQUAL.all=var3; EDIS; / No more. 交通灯控制实验一、实验目的1.熟悉28

17、12的指令系统;2.熟悉74HC573的使用方法。3.熟悉DSP的IO操作使用方法。二、实验设备1.一台装有CCS2000软件的计算机;2.插上2812主控板的DSP实验箱;3.DSP硬件仿真器。三、实验原理此模块由发光二极管和一个锁存器组成。数据由2812模块的低八位输入,锁存器的控制信号由2812模块输出,但经由CPLD模块译码后再控制锁存器。四、实验步骤1. 把2812模块小板插到大板上;2. 在CCS2000环境中打开本实验的工程编译Example_crossled.prj,生成输出文件,通过仿真器把执行代码下载到DSP芯片;3. 运行程序,发光二极管按交通灯方式点亮熄灭。 4. 参考

18、源代码,自行修改程序,实现不同的交通灯控制方式。 五、实验心得体会通过次实验中,使我掌握了 2812的指令系统和74HC573的使用方法。同时,使我掌握了DSP的IO操作使用方法。实验程序见附录:附录: #include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void

19、 delay_loop(void);void Gpio_select(void);/ Global variable for this examplemain() / Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl(); / Specific clock setting for this example: EALLOW; EDIS;/ Step

20、 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example / For this example use the following configuration: Gpio_select(); / Step 3. Clear all interrupts and initialize PIE vect

21、or table:/ Disable CPU interrupts DINT;/ Initialize the 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 f

22、lags: IER = 0x0000; 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

23、_DefaultIsr.c./ This 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 InitXintf(); / For this example, init the Xintf/ Step 5. User spec

24、ific code, enable interrupts: while(1) GpioDataRegs.GPADAT.all =0xdc80; Reg00=0x00; delay_loop(); GpioDataRegs.GPADAT.all =0xec40; Reg00=0x00; delay_loop(); GpioDataRegs.GPADAT.all =0xf0c0; Reg00=0x00; delay_loop(); GpioDataRegs.GPADAT.all =0xec40; Reg00=0x00; delay_loop(); void delay_loop() short i

25、,j; for (i = 0; i 32767; i+) for (j = 0; j 50; j+);void Gpio_select(void) Uint16 var1; Uint16 var2; Uint16 var3; var1= 0x0000;/ sets GPIO Muxs as I/Os var2= 0xFFFF;/ sets GPIO DIR as outputs var3= 0x0000;/ sets the Input qualifier values EALLOW; GpioMuxRegs.GPAMUX.all=var1; GpioMuxRegs.GPBMUX.all=va

26、r1; GpioMuxRegs.GPDMUX.all=var1; GpioMuxRegs.GPFMUX.all=var1; GpioMuxRegs.GPEMUX.all=var1; GpioMuxRegs.GPGMUX.all=var1; GpioMuxRegs.GPADIR.all=var2;/ GPIO PORTs as output GpioMuxRegs.GPBDIR.all=var2; / GPIO DIR select GPIOs as output GpioMuxRegs.GPDDIR.all=var2; GpioMuxRegs.GPEDIR.all=var2; GpioMuxR

27、egs.GPFDIR.all=var2; GpioMuxRegs.GPGDIR.all=var2; GpioMuxRegs.GPAQUAL.all=var3; / Set GPIO input qualifier values GpioMuxRegs.GPBQUAL.all=var3; GpioMuxRegs.GPDQUAL.all=var3; GpioMuxRegs.GPEQUAL.all=var3; EDIS; /=/ No more./=步进电机控制实验一、实验目的1. 掌握2812通用IO口的使用方法;2. 掌握2812对步进电机的控制。二、实验设备.一台装有CCS软件的计算机;.DS

28、P实验箱(插上电机模块);.DSP硬件仿真器;.示波器。三、实验原理步进电机工作原理,给步进脉冲电机就转,不给脉冲电机就不转,步进脉冲的频率越高,步进控制电机就转的越快;改变各相的通电方式可以改变电机的运行方式;改变通电顺序可以控制步进电机的运行方式;改变通电顺序可以控制步进电机的正反转。步进电机的控制问题可以总结为两点:1. 产生工作方式需要的时序脉冲;2. 控制步进电机的速度使它始终遵循加速-匀速-减速的规律工作。对于I/O口有二类寄存器:1. 控制寄存器和数据方向寄存器,使用方法如下:首先确定引脚的功能,即IO控制器寄存器,为1表示引脚功能是原模块的功能,否则为IO功能。2. 如果引脚被

29、配置为IO功能,就需要确定它的方向:输入还是输出,。为1表示是输出引脚,否则是输入引脚。对于IO功能的输入或输出是通过读写相应的数据方向寄存器来实现。输入引脚对应读操作;输出引脚对应写操作。四、实验步骤1. 连接好DSP开发系统;2. 本实验工程文件(Example_stepmotor.pjt),编译,下载程序到DSP;运行程序,用观察步进电机运行方向和速度的变化;五、实验心得体会通过本次实验对于2812通用的IO口进一步熟悉实验,使我基本掌握了2812通用的IO口的使用方法,加深了对IO口的认识。本次实验的主要目的是通过2812对步进机的的控制,开始对于程序的设计没有头绪,通过查阅步进机控制

30、的原理,结合有关资料才正式设计出程序,基本掌握了2812对步进机的控制,也更加熟悉了对DSP程序的设计,受益匪浅。程序:#include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void delay_loop(void);void Gpio_select(void);/

31、 Global variable for this exampleshort codetab17=0x0001,0x0002,0x0004,0x0008,0x0008,0x0004,0x0002,0x0001,0x0001,0x0002,0x0004,0x0008,0x0001,0x0002,0x0004,0x0008,0x0000;main() short i,j; / Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in t

32、he DSP281x_SysCtrl.c file. InitSysCtrl();/ Specific clock setting for this example: EALLOW; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example/ For this example

33、use the following configuration: Gpio_select();/ Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are cleared. / This function is foun

34、d in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; 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

35、used in this example. This is useful for debug purposes./ The shell ISR routines are found in DSP281x_DefaultIsr.c./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_InitPeripherals.c/ InitPeripherals(

36、); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: GpioDataRegs.GPADAT.all=0; Reg06=0x00; while(1) for(j=0;j400;j+) for(i=0;i4;i+) GpioDataRegs.GPADAT.all =codetabi; Reg06=0x00; delay_loop(); for(j=0;j400;j+) for(i=4;i8;

37、i+) GpioDataRegs.GPADAT.all =codetabi; Reg06=0x00; delay_loop(); void delay_loop() short i,j; for (i = 0; i 1000; i+) for (j = 0; j 10; j+);void Gpio_select(void) Uint16 var1; Uint16 var2; Uint16 var3; var1= 0x0000;/ sets GPIO Muxs as I/Os var2= 0xFFFF;/ sets GPIO DIR as outputs var3= 0x0000;/ sets

38、the Input qualifier values EALLOW; GpioMuxRegs.GPAMUX.all=var1; GpioMuxRegs.GPBMUX.all=var1; GpioMuxRegs.GPDMUX.all=var1; GpioMuxRegs.GPFMUX.all=var1; GpioMuxRegs.GPEMUX.all=var1; GpioMuxRegs.GPGMUX.all=var1;GpioMuxRegs.GPADIR.all=var2;/ GPIO PORTs as output GpioMuxRegs.GPBDIR.all=var2; / GPIO DIR s

39、elect GPIOs as output GpioMuxRegs.GPDDIR.all=var2; GpioMuxRegs.GPEDIR.all=var2; GpioMuxRegs.GPFDIR.all=var2; GpioMuxRegs.GPGDIR.all=var2; GpioMuxRegs.GPAQUAL.all=var3; / Set GPIO input qualifier values GpioMuxRegs.GPBQUAL.all=var3; GpioMuxRegs.GPDQUAL.all=var3; GpioMuxRegs.GPEQUAL.all=var3; EDIS; /=

40、/ No more./=一、实验目的1. 要求学生掌握2812 PWM的使用方法;2. 掌握2812对直流电机的控制。二、实验设备.一台装有CCS软件的计算机;.DSP实验箱;.DSP硬件仿真器;.示波器。三、实验原理电机模块的原理图如下四、实验步骤3. 连接好DSP开发系统;4. 本实验工程文件(Example_dcmotor.pjt),编译,下载程序到DSP;5. 运行程序,用观察直流电机运行方向和速度的变化;五、实验心得体会通过本次实验,认识了PWM的使用方法,通过亲身体验,初步掌握了2812对PWM的控制使用方法,加深了对PWM的认识。本次实验的主要目的是通过2812对直流电机的控制,

41、开始对于程序的设计没有头绪,通过查阅直流电机的原理,结合有关资料才正式设计出程序,基本掌握了2812对直流电机的控制,也更加熟悉了对DSP程序的设计,受益匪浅。附:实验程序:#include include/DSP281x_Device.h / DSP281x Headerfile Include File#include include/DSP281x_Examples.h / DSP281x Examples Include File/ Prototype statements for functions found within this file.void init_eva(void)

42、;void init_evb(void);void delay_loop();/ Global variable for this examplemain() unsigned short i;/ Step 1. Initialize System Control:/ PLL, WatchDog, enable Peripheral Clocks/ This example function is found in the DSP281x_SysCtrl.c file. InitSysCtrl();/ Specific clock setting for this example: EALLO

43、W; EDIS;/ Step 2. Initalize GPIO: / This example function is found in the DSP281x_Gpio.c file and/ illustrates how to set the GPIO to its default state./ InitGpio(); / Skipped for this example/ Initialize only GPAMUX and GPBMUX for this test EALLOW; / Enable PWM pins GpioMuxRegs.GPAMUX.all = 0x00FF;

44、 / EVA PWM 1-6 pins GpioMuxRegs.GPBMUX.all = 0x00FF; / EVB PWM 7-12 pins EDIS;/ Step 3. Clear all interrupts and initialize PIE vector table:/ Disable CPU interrupts DINT;/ Initialize the PIE control registers to their default state./ The default state is all PIE interrupts disabled and flags/ are c

45、leared. / This function is found in the DSP281x_PieCtrl.c file. InitPieCtrl();/ Disable CPU interrupts and clear all CPU interrupt flags: IER = 0x0000; IFR = 0x0000;/ Initialize the PIE vector table with pointers to the shell Interrupt / Service Routines (ISR). / This will populate the entire table,

46、 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./ This function is found in DSP281x_PieVect.c. InitPieVectTable();/ Step 4. Initialize all the Device Peripherals:/ This function is found in DSP281x_Init

47、Peripherals.c/ InitPeripherals(); / Not required for this example InitXintf(); / For this example, init the Xintf/ Step 5. User specific code, enable interrupts: init_eva(); /init_evb(); while(1) for(i=0;i65535;i+=1000) Reg06=0; EvbRegs.CMPR6 = i; delay_loop(); void delay_loop() short i,j; for (i =

48、0; i 1000; i+) for (j = 0; j 10; j+);void init_eva()/ EVA Configure T1PWM, T2PWM, PWM1-PWM6 / Initalize the timers / Initalize EVA Timer1 EvaRegs.T1PR = 0xFFFF; / Timer1 period EvaRegs.T1CMPR = 0x3C00; / Timer1 compare EvaRegs.T1CNT = 0x0000; / Timer1 counter / TMODE = continuous up/down / Timer ena

49、ble / Timer compare enable EvaRegs.T1CON.all = 0x1042; / Initalize EVA Timer2 EvaRegs.T2PR = 0x0FFF; / Timer2 period EvaRegs.T2CMPR = 0x03C0; / Timer2 compare EvaRegs.T2CNT = 0x0000; / Timer2 counter / TMODE = continuous up/down / Timer enable / Timer compare enable EvaRegs.T2CON.all = 0x1042; / Set

50、up T1PWM and T2PWM / Drive T1/T2 PWM by compare logic EvaRegs.GPTCONA.bit.TCMPOE = 1; / Polarity of GP Timer 1 Compare = Active low EvaRegs.GPTCONA.bit.T1PIN = 1; / Polarity of GP Timer 2 Compare = Active high EvaRegs.GPTCONA.bit.T2PIN = 2; / Enable compare for PWM1-PWM6 /EvaRegs.CMPR1 = 0x0C00; /Eva

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论