我用2407写了一个产生方波的简单程序,但是烧进去后发现出不来波形,不知道是怎么回事,难道是我的程序错了吗?各位能帮我看看是怎么回事吗?
//这是主程序 #include "DSP2407A.h"
#define uint unsigned int #define uchar unsigned char
uint cn; //计数次数
//Iintial system configure void InitSys(void) { asm (" clrc OVM"); asm (" clrc CNF"); //B0--数据存储器 *SCSR1 = 0x81FE; *WDCR = 0x0E8; *IMR = 0x0001; *IFR = 0x0FFFF; *MCRA = 0x0000; //配置成一般IO口 *PBDATDIR = 0x0FFFF; //PB为输出1 }
int main(void) { InitSys(); asm (" setc INTM"); //关中断
while (1) { //PB口产生一个方波 *PBDATDIR = 0x0FF00; //PB输出0 for(cn=0; cn<35000; cn++){;} //延时 *PBDATDIR =0x0FFFF; //PB输出1 for(cn=0; cn<35000; cn++){;} //PS:把0x0ff00换成0xff00也能通过编译,奇怪了 } return 0; }
//这是cmd配置文件
MEMORY { PAGE 0: VECS origin = 0000h, length = 0040h FLASH: origin = 0100h, length = 0F00h SARAM_P: origin = 8100h, length = 1000h
PAGE 1: B2: origin = 0060h, length = 020h B0: origin = 200h, length = 100h B1: origin = 300h, length = 100h SARAM_D: origin = 0800h, length = 0800h EXT_RAM: origin = 8000h , length = 8000h }
SECTIONS { .vectors: > VECS PAGE 0 .text: > FLASH PAGE 0 .data: > FLASH PAGE 0 .bss: > SARAM_D PAGE 1 .stack: > SARAM_D PAGE 1 .buffer: > SARAM_D PAGE 1 }
|