⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 example_281x_led8x8.c

📁 用DSP实现对4*4LED的控制程序
💻 C
字号:
/*
;**************************************************************
;*				   北京达盛科技有限公司
;*                    研    发    部
;*
;*             	http://www.techshine.com
;*************************************************************/
/*----------------------- 文件信息 ----------------------------                                      
;*  
;* 文件名称 : Example_DSP281x_LED.c 	
;* 适用平台 : DSP专家4实验箱
;* CPU类型  : DSP TMS320F2812 
;* 软件环境 : CCS2.20 (2000系列)
;* 扩展模块 : E-LAB1:7279扩展模块
;* 试验接线 : 1、实验箱的拨码开关K9拨到左侧,选择左侧的CPU1,2812CPU板插接到
;*               左侧的CPU插槽里;实验箱其它的拨码开关无需具体设置;2812 CPU
;*               板上的跳线采用出厂设置即可:JUMP1的2和3短接,JUMP2的1和2短接;
;*            2、用导线连接实验箱IO单元3的I/O1~4到LED扩展模块的DOT1A1~4;
;*            3、DOT1K1~3用导线接实验箱的GND;
;* 试验现象 : 观察LED1第1行点阵的变化。
;* 完成日期 :2007年3月6日16时32分06秒            
*/    
/*************************头文件*********************************/
/*******************************************************************/
#include "DSP281x_Device.h"     // DSP281x Headerfile Include File
#include "DSP281x_Examples.h"   // DSP281x Examples Include File
#define   OutIO *(unsigned int *)0x88009 //输出地址
//--------------------------------------------------
/***************************************************
			 函数定义 
***************************************************/
void dellay(unsigned int t)
   {
    unsigned int i;
    for(i=0;i<t;i++);     //延时等待转换完成
   } 

/******************************主程序******************************/
void main()
{    
   int k;
// PLL, WatchDog, enable Peripheral Clocks
// This example function is found in the DSP281x_SysCtrl.c file.
   InitSysCtrl();
   
// Disable CPU interrupts and clear all CPU interrupt flags:
   IER = 0x0000;
   IFR = 0x0000;
   	  
// Disable CPU interrupts 
   DINT;   
//  loop of the main        

   while(1)
    {
      for(k=0;k<16;k++)
      {
       OutIO = k ;
      
       dellay(60000);
       dellay(60000);
      }

      for(k=15;k>=0;k--)
      {
       OutIO = k ;
      
       dellay(60000);
       dellay(60000);
      }     
    }
  }
/****************************本程序结束***************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -