/*
** ===================================================================
**     Method      :  TickTimer_Init (bean TimerInt)
**
**     Description :
**         This method is internal. It is used by Processor Expert
**         only.
** ===================================================================
*/
void TickTimer_Init(void)
{
  CmpHighVal = 3124;                   /* Compare register value for high speed CPU mode */
  SetCV(CmpHighVal);                   /* Store appropriate value to the compare register according to the selected high speed CPU mode */
  SetPV(3);                            /* Set prescaler register according to the selected high speed CPU mode */
  HWEnDi();                            /* Enable/disable device according to status flags */
}
示例#2
0
/*
** ===================================================================
**     Method      :  PIT_1ms_Init (component TimerInt)
**
**     Description :
**         Initializes the associated peripheral(s) and the beans 
**         internal variables. The method is called automatically as a 
**         part of the application initialization code.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PIT_1ms_Init(void)
{
  /* PIT0_CTRL: SLAVE=0,??=0,??=0,??=0,??=0,??=0,CLKSEL=0,??=0,PRESCALER=0,PRF=0,PRIE=1,CNT_EN=0 */
  setReg(PIT0_CTRL,0x02);              /* Set up control register */
  SetCV((word)0xC350);                 /* Store appropriate value to the compare register according to the selected high speed CPU mode */
  SetPV((byte)0x01);                   /* Set prescaler register according to the selected high speed CPU mode */
  HWEnDi();                            /* Enable/disable device according to status flags */
}
示例#3
0
/*
** ===================================================================
**     Method      :  TI1_Init (component TimerInt)
**
**     Description :
**         Initializes the associated peripheral(s) and the beans 
**         internal variables. The method is called automatically as a 
**         part of the application initialization code.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void TI1_Init(void)
{
  /* TMR2_CTRL: CM=0,PCS=0,SCS=0,ONCE=0,LENGTH=1,DIR=0,Co_INIT=0,OM=4 */
  setReg(TMR2_CTRL,36);                /* Stop timer, use alternating compare registers */
  /* TMR2_SCR: TCF=0,TCFIE=1,TOF=0,TOFIE=0,IEF=0,IEFIE=0,IPS=0,INPUT=0,Capture_Mode=0,MSTR=0,EEOF=0,VAL=0,FORCE=0,OPS=0,OEN=0 */
  setReg(TMR2_SCR,16384);              /* Enable compare interrupt */
  setReg(TMR2_CNTR,0);                 /* Reset counter register */
  setReg(TMR2_LOAD,0);                 /* Reset load register */
  setReg(TMR2_CMP1,31999);             /* Set up compare 1 register */
  setReg(TMR2_CMP2,31999);             /* Set up compare 2 register */
  /* TMR2_COMSCR: DBG_EN=0,??=0,??=0,??=0,??=0,??=0,??=0,TCF2EN=0,TCF1EN=0,TCF2=0,TCF1=0,CL2=1,CL1=2 */
  setReg(TMR2_COMSCR,6);               /* Compare load control */
  SetCV((word)31999);                  /* Store appropriate value to the compare register according to the selected high speed CPU mode */
  SetPV((byte)8);                      /* Set prescaler register according to the selected high speed CPU mode */
  setRegBitGroup(TMR2_CTRL,CM,1);      /* Run counter */
}
示例#4
0
/*
** ===================================================================
**     Method      :  FC81_Init (component FreeCntr8)
**
**     Description :
**         Initializes the associated peripheral(s) and the beans 
**         internal variables. The method is called automatically as a 
**         part of the application initialization code.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void FC81_Init(void)
{
  /* TMR0_CTRL: CM=0,PCS=0,SCS=0,ONCE=0,LENGTH=1,DIR=0,Co_INIT=0,OM=4 */
  setReg(TMR0_CTRL,36);                /* Stop timer, use alternating compare registers */
  /* TMR0_SCTRL: TCF=0,TCFIE=1,TOF=0,TOFIE=0,IEF=0,IEFIE=0,IPS=0,INPUT=0,CAPTURE_MODE=0,MSTR=0,EEOF=0,VAL=0,FORCE=0,OPS=0,OEN=0 */
  setReg(TMR0_SCTRL,16384);
  setReg(TMR0_CNTR,0);                 /* Reset counter register */
  setReg(TMR0_LOAD,0);                 /* Reset load register */
  setReg(TMR0_COMP1,255);              /* Set up compare 1 register */
  setReg(TMR0_COMP2,255);              /* Set up compare 2 register */
  /* TMR0_CSCTRL: DBG_EN=0,FAULT=0,ALT_LOAD=0,??=0,??=0,??=0,??=0,TCF2EN=0,TCF1EN=0,TCF2=0,TCF1=0,CL2=1,CL1=2 */
  setReg(TMR0_CSCTRL,6);               /* Enable compare 1 interrupt */
  TTicks = 0;                          /* Counter of timer ticks */
  TOvf = FALSE;                        /* Counter overflow flag */
  SetCV((word)255);                    /* Store appropriate value to the compare register according to the selected high speed CPU mode */
  SetPV((byte)8);                      /* Set prescaler register according to the selected high speed CPU mode */
  setRegBitGroup(TMR0_CTRL,CM,1);      /* Run counter */
}