li duanyang

S12HY64 RTI

Discussion created by li duanyang on Nov 2, 2011

HELP!! I am come from china,my English is not well,so some problem describe not clear,

when MCU wake up from pseudo stop mode below code if have any affect oscillator?

void _EntryPoint(void)
{
  /* ### MC9S12HY64_100 "Cpu" init code ... */
  /*  PE initialization code after reset */
  /* DIRECT: DP15=0,DP14=0,DP13=0,DP12=0,DP11=0,DP10=0,DP9=0,DP8=0 */
  setReg8(DIRECT, 0U);                 
  /* IVBR: IVB_ADDR=255 */
  setReg8(IVBR, 255U);                 
  /* ECLKCTL: NECLK=1,??=0,DIV16=0,EDIV4=0,EDIV3=0,EDIV2=0,EDIV1=0,EDIV0=0 */
  setReg8(ECLKCTL, 128U);              
  /*  System clock initialization */
  /* CPMUPROT: ??=0,??=0,??=1,??=0,??=0,??=1,??=1,PROT=0 */
  setReg8(CPMUPROT, 38U);              /* Disable protection of clock configuration registers */
  /* CPMUCLKS: PSTP=1 */
  setReg8Bits(CPMUCLKS, 64U);          
  /* CPMUCLKS: PLLSEL=1 */
  setReg8Bits(CPMUCLKS, 128U);         /* Enable the PLL to allow write to divider registers */
  /* CPMUREFDIV: REFFRQ1=0,REFFRQ0=1,??=0,??=0,REFDIV3=0,REFDIV2=0,REFDIV1=0,REFDIV0=0 */
  setReg8(CPMUREFDIV, 64U);            /* Set the divider register */
  /* CPMUSYNR: VCOFRQ1=0,VCOFRQ0=0,SYNDIV5=0,SYNDIV4=0,SYNDIV3=0,SYNDIV2=1,SYNDIV1=0,SYNDIV0=0 */
  setReg8(CPMUSYNR, 4U);               /* Set the multiplier register */
  /* CPMUPOSTDIV: ??=0,??=0,??=0,POSTDIV4=0,POSTDIV3=0,POSTDIV2=0,POSTDIV1=0,POSTDIV0=0 */
  setReg8(CPMUPOSTDIV, 0U);            /* Set the post divider register */
  /* CPMUOSC: OSCE=1,OSCBW=0,??=0,OSCFILT=0 */
  setReg8(CPMUOSC, 128U);              /* Enable the oscillator */
  /* CPMUPLL: ??=0,??=0,FM1=0,FM0=0,??=0,??=0,??=0,??=0 */
  setReg8(CPMUPLL, 0U);                /* Set the PLL frequency modulation */
  while(CPMUFLG_UPOSC == 0U) {         /* Wait until the oscillator is qualified by the PLL */
  }
  /* CPMUPROT: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,PROT=0 */
  setReg8(CPMUPROT, 0U);               /* Enable protection of clock configuration registers */
  /* CPMUCOP: RSBCK=1,WRTMASK=1 */
  setReg8Bits(CPMUCOP, 96U);           
  /* CPMUHTCTL: ??=0,??=0,VSEL=0,??=0,HTE=0,HTDS=0,HTIE=0,HTIF=0 */
  setReg8(CPMUHTCTL, 0U);              
  /*** End of PE initialization code after reset ***/
  /*lint -save  -e950 Disable MISRA rule (1.1) checking. */
  __asm("jmp _Startup");               /* Jump to C startup code */
  /*lint -restore Enable MISRA rule (1.1) checking. */
}

my goal is to display a very correct time.any could display in low power.

when MCU is working normal mode,my RTI interrupt time is 262ms, RTI interrupt coming,when some other interrupt is work, so RTI interrupt must wait  ,this time ,if have any effect with my RTI clock veracity,

thank you:smileywink:

Outcomes