我就是希望用xintf的,但主要是我没用过,我那天配置了一下,但是配置完之后,数据写不出去,估计是我配置的过程中少了些什么步骤呢。麻烦您看一下嘛,如果配置正常的话,程序跑起来D0口是会输出方波的,但是我用示波器什么也看不到,led灯在交替闪烁,说明程序是跑起来的了。贴出来的程序,我就是这样子配置的
void main(void)
{
short temp=0;
InitSysCtrl();
DINT;
IER=0x0000;
IFR=0x0000;
InitPieCtrl();
InitPieVectTable();
initledgpio();
init_zone7();
LED1off;
LED2off;
while(1)
{
temp++;
if(temp==1)
{
uint16* p=(uint16*)0x20000
*p=0x00000001;
LED1on;
LED2off;
}
if(temp==2)
{
temp=0;
uint16* p=(uint16*)0x20000
*p=0x00000001;
LED1off;
LED2on;
}
delay(10000);
}
}
void init_zone7(void)
{
EALLOW;
SysCtrlRegs.PCLKCR3.bit.XINTFENCLK = 1;
InitXintf16Gpio();
XintfRegs.XINTCNF2.bit.XTIMCLK = 0;
XintfRegs.XINTCNF2.bit.WRBUFF = 3;
XintfRegs.XINTCNF2.bit.CLKOFF = 0;
XintfRegs.XINTCNF2.bit.CLKMODE = 0;
XintfRegs.XTIMING7.bit.XWRLEAD = 1;//写建立等待状态周期=1XTIMCLK
XintfRegs.XTIMING7.bit.XWRACTIVE = 2;//写激活等待周期=2XTIMCLK
XintfRegs.XTIMING7.bit.XWRTRAIL = 1;//写追踪等待周期=1XTIMCLK
XintfRegs.XTIMING7.bit.XRDLEAD = 1;//读建立等待状态周期=1XTIMCLK
XintfRegs.XTIMING7.bit.XRDACTIVE = 3;//读激活等待周期=3XTIMCLK
XintfRegs.XTIMING7.bit.XRDTRAIL = 0;//读追踪等待周期=0XTIMCLK
XintfRegs.XTIMING7.bit.X2TIMING = 0;
XintfRegs.XTIMING7.bit.USEREADY = 0;
XintfRegs.XTIMING7.bit.READYMODE = 0;
// 1,1 = x16 数据线(采用)
// 0,1 = x32 数据线
XintfRegs.XTIMING7.bit.XSIZE = 3;
EDIS;
//占用N+1个指令周期
asm(" RPT #7 || NOP");
} |