Chinaunix首页 | 论坛 | 博客
  • 博客访问: 275394
  • 博文数量: 39
  • 博客积分: 1215
  • 博客等级: 军士长
  • 技术积分: 471
  • 用 户 组: 普通用户
  • 注册时间: 2011-12-17 19:34
个人简介

grace under pressure

文章分类

全部博文(39)

文章存档

2013年(6)

2012年(28)

2011年(5)

分类: C/C++

2013-12-25 13:12:31

软件平台:CCS V5.4.0

硬件平台:SEED-DEC5502

说明:DSP/BIOS、CSL以及创建工程见“DspBios V542_CSL LED测试程序1”,该工程还是基于DspBios V5.4.2.01.09例程Hello

 

步骤:

A、              双击打开hello.tcf,在PRD上面右击,选择Insert PRD,输入名称,例程中使用PRD0,见附图1

B、              PRD0上面右击,选择Properties,将period修改为500Function,修改_PRDFxn,见附图2

C、              关闭tcf配置窗口,并再修改hello.c文件为附件中内容,并在工程的Properties中将CSL库文件的路径添加进去,见附图3

D、              下载运行

注意:完成步骤E后运行会提示#35 #error NO CHIP DEFINED,解决方法为:选择工程,右击选择Properties,然后Build->C5500 Compiler->Advanced Options->Predefined Symbols中添加"CHIP_5502"

附件:


点击(此处)折叠或打开

  1. #include <std.h>
  2. #include <stdio.h>
  3. #include <log.h>

  4. #include "hellocfg.h"
  5. #include <csl.h>
  6. #include <csl_pll.h>
  7. #include <csl_chip.h>
  8. #include <csl_irq.h>
  9. #include <csl_gpt.h>

  10. void delay_vt(Int i);
  11. /* Define the power-off time length of LED */
  12. Uint16 LEDMARK = 0;        // 设置指示灯的开关标志

  13. /* 通过定义宏来控制两个外围存储器映射的寄存器,从而实现对GPIO口的控制 */
  14. #define GPIODIR     (*(volatile ioport Uint16*)(0x3400))
  15. #define GPIODATA     (*(volatile ioport Uint16*)(0x3401))
  16. /*
  17.  * ======== main ========
  18.  */
  19. Void main()
  20. {
  21.     LOG_printf(&trace, "hello world!");

  22.     /* Config GPIO7 in order to ignite led D5*/
  23.     GPIODIR = 0x80;    // config the GPIO7 as output pin
  24.     /* fall into DSP/BIOS idle loop */
  25.     return;
  26. }

  27. void PRDFxn()
  28. {
  29.     if(LEDMARK==0)
  30.              {
  31.                  GPIODATA = 0x00;                /* 关闭指示灯D5 */
  32.                  LEDMARK = 1;
  33.              }
  34.              else
  35.              {
  36.                  GPIODATA = 0x80;                /* 打开指示灯D5 */
  37.                  LEDMARK = 0;
  38.              }
  39. }

附图



附图1

附图2

附图3

阅读(2577) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~