是否可以直接对GPBDAT寄存器进行直接判断
时间:10-02
整理:3721RD
点击:
#include"2440addr.h"
int time=0;
void __irq Timer0_ISR()
{
rSRCPND = 1<<10;
rINTPND = 1<<10;//清除中断
time++;
if((time==2)&(rGPBDAT==0x7ff))
{
rGPBDAT = ~rGPBDAT;
time=0;
}
if((time==5)&(rGPBDAT==0x0))
{
rGPBDAT = ~rGPBDAT;
time=0;
}
}
void Main()
{
rGPBCON = (1<<10)|(1<<12)|(1<14)|(1<<16);
rGPBDAT = ~0;
rMPLLCON = ((127<<12)|(2<<3)|(1<<0));
rCLKdivN = (0X2<<2)|(0X1<<0);//PCLK=50Mhz
rTCFG0=249<<0;
rTCFG1=2<<0;
rTCNTB4=25000;
rTCON=1<<1;
rTCON=9<<0;
rSRCPND=1<<10;
rINTPND=1<<10;//防止之前有中断使标志位置1(置1清0)
rINTMSK=~(1<<10);
pISR_TIMER0=(unsigned int)Timer0_ISR;//中断服务声明
}
汇编引导是正确的.
基本功能是实现灭灯2秒,亮灯5秒,数据寄存器(红色字体)的写法是否正确.
int time=0;
void __irq Timer0_ISR()
{
rSRCPND = 1<<10;
rINTPND = 1<<10;//清除中断
time++;
if((time==2)&(rGPBDAT==0x7ff))
{
rGPBDAT = ~rGPBDAT;
time=0;
}
if((time==5)&(rGPBDAT==0x0))
{
rGPBDAT = ~rGPBDAT;
time=0;
}
}
void Main()
{
rGPBCON = (1<<10)|(1<<12)|(1<14)|(1<<16);
rGPBDAT = ~0;
rMPLLCON = ((127<<12)|(2<<3)|(1<<0));
rCLKdivN = (0X2<<2)|(0X1<<0);//PCLK=50Mhz
rTCFG0=249<<0;
rTCFG1=2<<0;
rTCNTB4=25000;
rTCON=1<<1;
rTCON=9<<0;
rSRCPND=1<<10;
rINTPND=1<<10;//防止之前有中断使标志位置1(置1清0)
rINTMSK=~(1<<10);
pISR_TIMER0=(unsigned int)Timer0_ISR;//中断服务声明
}
汇编引导是正确的.
基本功能是实现灭灯2秒,亮灯5秒,数据寄存器(红色字体)的写法是否正确.
我是新手,还请老鸟多多指教!