我用的周立功的ARM Executable Image for plc2200工程模板,开发板是zlg2210 #include "config.h"
#define BEEPCON 1 << 7 //控制喇叭发音 uint8 flag = 0; //初始化定时器1 void Time1_Init(void) { T1TC = 0; T1TCR = 0x00; //禁止定时器1使能 T1PR = Fpclk / 1000; T1MCR = 0x03; T1MR0 = 5000; T1TCR = 0x01; } //初始化GPIO void GPIO_Init(void) { PINSEL0 = 0x0A000000; IO0DIR = BEEPCON; IO0SET = BEEPCON; } //定时器1中断程序 void __irq Time1_IRQ(void) { T1TCR = 0x03; if(flag == 0) { IO0CLR = BEEPCON; flag = 1; } else { IO0SET = BEEPCON; flag = 0; } VICVectAddr = 0; } //设置定时器1中断处理初始化 void Int_Init(void) { VICIntSelect = 0x00000000; VICIntEnable = 1 << 5; VICVectCntl0 = (uint32)Time1_IRQ; } int main (void) { // add user source code GPIO_Init(); Time1_Init(); Int_Init(); while(1); return 0; }
调试时候 调试老是在 int main (void) { // add user source code GPIO_Init(); Time1_Init(); Int_Init(); while(1); return 0; } 中 GPIO_Init(); Time1_Init(); Int_Init(); 之间反复运行,while()走不到,我不知道问题出在那里,请周工看看 文件在附件里,请帮忙看看是怎么回事 相关链接:https://bbs.21ic.com/upfiles/img/20079/2007922202325731.rar |