📄 multidspwelcome.c
字号:
// ********************************************
// Sample DSP application used to showcase GEL
// components controlling DSP code
// ********************************************
#include <stdio.h>
#include "VC5402.h"
//#include <VC5402.h>
#define TRUE 1
unsigned int *ExRamStart = (unsigned int *)0x8000;
int counterValue = 0;
int change = 0;
int y=0;
int i=0;
int j=0;
int ms=0;
void main()
{
asm(" STM #0000h,CLKMD ");
while(*CLKMD & 0x01 );
asm(" STM #40C7h,CLKMD "); //设置CPU运行频率=100M
/* 40C7h:5*clkin =100M
30c7h:4*clkin =80M
20c7h:3*clkin =60M
10C7h:2*clkin =40M
*/
asm(" stm #4240h, SWWSR ");
//2 wait except for on-chip program 1
asm(" stm #00A0h, PMST "); //MP/MC = 0, IPTR = 001,ovly=1,
asm(" stm #0802h, BSCR ");
asm(" STM #0h,IMR ");
asm(" STM #0010h,TCR "); //关定时器
asm(" STM #0186ah,PRD ");//1ms
asm(" STM #0C2fh,TCR "); //TCR=最后四位
asm(" STM #0008h,IFR ");//开timer0中断
j=0;
for(j=0;j<5;j++)
{
*(ExRamStart + 2*j) = 0xAAAA;
}
j=0;
for(j=0;j<5;j++)
{
*(ExRamStart + 2*j) = 0x5555;
}
// printf("Welcome to the World of DSP. %d\n",i) ;
if(*(ExRamStart + 0) == 0x5555)
{
printf("DSP address is error. %d\n",*(ExRamStart+i));
}
}
interrupt void timer0()
{
asm(" STM #0008h,IFR ");//clear timer0 interrupt flag
ms++;
if(ms==1000)
{
ms=0;
printf("Timer0 is OK.") ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -