c语言实验报告大气,dsp实验报告心得体会

sin_value[i]=100*(sin(2*pi*i/N)); }

实 验 报 告

07电本(1)班

学号

2007050344姓

名 杨宝辉 同组人

独立

实验日期

2010-5-20

室温

大气压

成 绩

数码管控制实验

一、实验目的 1. 2. 3. 熟悉2812的指令系统; 熟悉74HC573的使用方法。 熟悉DSP的IO操作使用方法。

二、实验设备

1. 一台装有CCS2000软件的计算机;

2. 插上2812主控板的DSP实验箱; 3. DSP硬件仿真器。

三、实验原理 此模块由数码管和四个锁存器组成 。数码管为共阴极型的。数据由2812模块的低八位输入,锁存器的控制信号由2812模块输出,但经由CPLD模块译码后再控制对应的八个

四、实验步骤 1. 把2812模块小板插到大板上;

2. 在CCS2000环境中打开本实验的工程编译Example_7segled.prj,生成输出文件,通过仿真器把执行代码下载到DSP芯片;

3. 运行程序;数码管会显示1~8的数字。

4. 参考源代码自行修改程序改变显示样式。

五、实验心得体会

通过本次实验中,基本掌握了2812的指令系统的特点,并能够了解并熟悉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_loop(void); void Gpio_select(void); // Global variable for this example short codetab[17]= {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 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 it's default state. // InitGpio(); // Skipped for 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 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, 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_InitPeripherals.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.all=0;

Reg04=0x00;

while(1)

{

for(i=0;i<17;i++)

{

GpioDataRegs.GPADAT.all

Reg01=0x00;

delay_loop();

}

for(i=0;i<17;i++)

{

GpioDataRegs.GPADAT.all

Reg02=0x00;

delay_loop();

}

for(i=0;i<17;i++)

{

GpioDataRegs.GPADAT.all

Reg03=0x00;

delay_loop();

}

for(i=0;i<17;i++)

{

GpioDataRegs.GPADAT.all

Reg04=0x00;

delay_loop();

}

} }

void delay_loop() {

=~codetab[i]; =~codetab[i]; =~codetab[i]; =~codetab[i];

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;

var2= 0xFFFF;

var3= 0x0000;

EALLOW; GpioMuxRegs.GPAMUX.all=var1;

// sets GPIO Muxs as I/Os

// sets GPIO DIR as outputs

// sets the Input qualifier values

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

// GPIO DIR select GPIOs as output

GpioMuxRegs.GPBDIR.all=var2;

GpioMuxRegs.GPDDIR.all=var2;

GpioMuxRegs.GPEDIR.all=var2;

GpioMuxRegs.GPFDIR.all=var2;

GpioMuxRegs.GPGDIR.all=var2;

GpioMuxRegs.GPAQUAL.all=var3;

GpioMuxRegs.GPBQUAL.all=var3;

GpioMuxRegs.GPDQUAL.all=var3;

GpioMuxRegs.GPEQUAL.all=var3;

EDIS; } // No more.

// Set GPIO input qualifier values 龙

实 验 报 告

07电本(1)班

学号

2007050344 姓

名 杨宝辉

同组人

独立

实验日期

2010-5-25

室温

大气压

成 绩

交通灯控制实验

一、实验目的

1. 熟悉2812的指令系统; 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. 参考源代码,自行修改程序,实现不同的交通灯控制方式。

五、实验心得体会

通过次实验中,使我掌握了 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 delay_loop(void); void Gpio_select(void); // Global variable for this example main() { // 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 2. Initalize GPIO:

// This example function is found in the DSP281x_Gpio.c file and // illustrates how to set the GPIO to it's default state. // InitGpio(); // Skipped for 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 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, 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_InitPeripherals.c // InitPeripherals(); // Not required for this example

InitXintf(); // For this example, init the Xintf // Step 5. User specific 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,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;

var2= 0xFFFF;

var3= 0x0000;

EALLOW; GpioMuxRegs.GPAMUX.all=var1;

// sets GPIO Muxs as I/Os // sets GPIO DIR as outputs // sets the Input qualifier values

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

// GPIO DIR select GPIOs as output

GpioMuxRegs.GPBDIR.all=var2;

GpioMuxRegs.GPDDIR.all=var2;

GpioMuxRegs.GPEDIR.all=var2;

GpioMuxRegs.GPFDIR.all=var2;

GpioMuxRegs.GPGDIR.all=var2;

GpioMuxRegs.GPAQUAL.all=var3;

GpioMuxRegs.GPBQUAL.all=var3;

GpioMuxRegs.GPDQUAL.all=var3;

GpioMuxRegs.GPEQUAL.all=var3;

EDIS;

}

// Set GPIO input qualifier values //============================= // No more. //=================

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值