打印

在线调试时,为什么程序跑到3F806D 6F00 SB 0,UNC 就停住了?

[复制链接]
3337|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
G21372|  楼主 | 2012-3-19 17:05 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
沙发
G21372|  楼主 | 2012-3-19 17:05 | 只看该作者
interrupt void adc_isr(void);
Uint16 a1;
Uint16 a2;
Uint16 a3;
Uint16 a4;

main()
{
InitSysCtrl();
EALLOW;
SysCtrlRegs.HISPCP.all = 0x3; // HSPCLK = SYSCLKOUT/6
EDIS;

DINT;

InitPieCtrl();

IER = 0x0000;
IFR = 0x0000;
InitPieVectTable();
EALLOW; // This is needed to write to EALLOW protected register
PieVectTable.ADCINT = &adc_isr;
EDIS; // This is needed to disable write to EALLOW protected registers
InitAdc(); // For this example, init the ADC

PieCtrlRegs.PIEIER1.bit.INTx6 = 1;
IER |= M_INT1; // Enable CPU Interrupt 1
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM

AdcRegs.ADCTRL1.bit.RESET=1;
asm("NOP");
AdcRegs.ADCTRL1.bit.RESET=0;
AdcRegs.ADCTRL1.bit.SUSMOD=3;
AdcRegs.ADCTRL1.bit.ACQ_PS=0;
AdcRegs.ADCTRL1.bit.CPS=0;
AdcRegs.ADCTRL1.bit.CONT_RUN=1; //连续运转模式,当接收到EOC信号后,排序器将从CONV00(对于SEQ1)状态重新开始装换
AdcRegs.ADCTRL1.bit.SEQ_CASC=1; //级联模式,SEQ1与SEQ2作为一个单16状态序列发生器操作
AdcRegs.ADCTRL3.bit.ADCCLKPS=1;
AdcRegs.ADCTRL3.bit.SMODE_SEL=0;

AdcRegs.ADCMAXCONV.all = 0x0003; // Setup 2 conv's on SEQ1
AdcRegs.ADCCHSELSEQ1.bit.CONV00 = 0x2; // Setup ADCINA2 as 1st SEQ1 conv.
AdcRegs.ADCCHSELSEQ1.bit.CONV01 = 0x3; // Setup ADCINA3 as 2nd SEQ1 conv.
AdcRegs.ADCCHSELSEQ1.bit.CONV02 = 0x4;
AdcRegs.ADCCHSELSEQ1.bit.CONV03 = 0x5;

AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ=0;
AdcRegs.ADCTRL2.bit.RST_SEQ1=0;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ1=1;
AdcRegs.ADCTRL2.bit.INT_MOD_SEQ1=0;
AdcRegs.ADCTRL2.bit.EVA_SOC_SEQ1=0;
AdcRegs.ADCTRL2.bit.EXT_SOC_SEQ1=0;
AdcRegs.ADCTRL2.bit.RST_SEQ2=0;
AdcRegs.ADCTRL2.bit.SOC_SEQ2=0;
AdcRegs.ADCTRL2.bit.INT_ENA_SEQ2=0;
AdcRegs.ADCTRL2.bit.INT_MOD_SEQ2=0;
AdcRegs.ADCTRL2.bit.EVB_SOC_SEQ2=0;

while(AdcRegs.ADCST.bit.SEQ1_BSY==0)
{       

AdcRegs.ADCTRL2.bit.SOC_SEQ1=1;

}
}


interrupt void adc_isr(void)
{

a1 = AdcRegs.ADCRESULT0 >>4;
a2 = AdcRegs.ADCRESULT1 >>4;
a3 = AdcRegs.ADCRESULT2 >>4;
a4 = AdcRegs.ADCRESULT3 >>4;
AdcRegs.ADCTRL2.bit.RST_SEQ1 = 1; // Reset SEQ1
AdcRegs.ADCST.bit.INT_SEQ1_CLR = 1; // Clear INT SEQ1 bit
PieCtrlRegs.PIEACK.all = PIEACK_GROUP1; // Acknowledge interrupt to PIE

return;
}

使用特权

评论回复
板凳
五谷道场| | 2012-3-19 18:09 | 只看该作者
没有设断点吗?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

197

主题

1658

帖子

5

粉丝