AnsweredAssumed Answered

MM912F634 input capture problem

Question asked by 贵阳 封 on Nov 7, 2013

I followed the datasheet carefully and set the value of related register,but when active edge happened ,no input capture interrupt was occurred even the input capture interrupt flag was not detected,my main routine was listed below Thanks for your help。

 

void main(void) {

volatile char rsr, vsr, srr;

/* D2D Init */

  D2DCTL1  = 0x8F;  // IRQ enable, max timeout

  D2DCTL0  = 0x80;  // D2D enable, 4Bit, !Stop in Wait, D2DCLK=BUS

  D2DSTAT0 = 0x80;  // Clear D2D Errors

 

 

  rsr = bRSR;       // Copy/Clear RSR

  vsr = bVSR;       // Copy/Clear VSR

  srr = bSRR;       // Copy/Clear SRR

 

  bCTR0 =  TRIM0;   // Copy Trim Information to Analog Die

  bCTR1 =  TRIM1;

  bCTR2 =  TRIM2;

  bCTR2 =  0x1E;    // Max VREG-Overvoltage Threshold Trim

  bCTR3 =  TRIM3;

 

  bLSCEN = 0x05;    // Enable LS Control

  //bLSCR = 0x00;     // Activate LS

  //bHSCR = 0x00;     // Activate HS

/* -------------------------------------------------------------- */

  //CRGCTL0_OSCEN=1;//内部时钟32K

  //CRGCTL0_BCLKS=1;

  bPTBC1=0X70;//PTB配置为输入口加上拉

  bPTBC2=0;

  bTIOS=0X0F; //IO通道配置输入捕捉

  bACCR=0;

  bTCTL2=0X3F;//上跳沿捕捉

  bTIE=0X07; // 捕捉中断使能

  bTCNT=0; //10ms

 

  bTSCR2=0X80; // 时钟溢出中断使能

  bTSCR1|=0X80; //计时使能/计时器标志清除使能

  EnableInterrupts;

 

  for(;;) {

    M=bPTB;

    N=bTIOS; 

    if(bTFLG1!=0)

    bHSCR=0X01 ;

    U=bTFLG1;

 

  } //for(;;) 

} //main

Original Attachment has been moved to: main.c.zip

Original Attachment has been moved to: Quest_Test.prm.zip

Original Attachment has been moved to: calango.h.zip

Original Attachment has been moved to: MC9S12I32.c.zip

Outcomes