Beispiel #1
0
/*
** ===================================================================
**     Method      :  SCI1_Init (component Init_SCI)
**
**     Description :
**         This method initializes registers of the SCI module
**         according to this Peripheral Initialization Bean settings.
**         Call this method in the user code to initialize the
**         module. By default, the method is called by PE
**         automatically; see "Call Init method" property of the
**         bean for more details.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
void SCI1_Init(void)
{
  getReg(SCI_STAT);                    /* Clear interrupt request flags */
  /* SCI_RATE: SBR=26,FRAC_SBR=0 */
  setReg16(SCI_RATE,208U);             /* Set prescaler bits */ 
  /* SCI_CTRL1: LOOP=0,SWAI=0,RSRC=0,M=0,WAKE=0,POL=0,PE=0,PT=0,TEIE=0,TIIE=0,RFIE=1,REIE=0,TE=1,RE=1,RWU=0,SBK=0 */
  setReg16(SCI_CTRL1,44U);             /* Set the SCI control register */ 
  /* SCI_CTRL2: TFCNT=0,TFWM=0,RFCNT=0,RFWM=0,FIFO_EN=0,??=0,LIN_MODE=0,??=0,??=0,??=0 */
  setReg16(SCI_CTRL2,0U);              /* Set the SCI control register */ 
}
Beispiel #2
0
/*
** ===================================================================
**     Method      :  DA1_Init (component DAC)
**
**     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 DA1_Init(void)
{
  /* DAC_CTRL: FILT_CNT=0,FILT_EN=0,??=0,??=0,??=0,??=0,??=0,??=0,UP=0,DOWN=0,AUTO=0,SYNC_EN=0,FORMAT=0,PDN=1 */
  setReg16(DAC_CTRL, 0x01U);            
  /* DAC_DATA: DATA=0x0800 */
  setReg16(DAC_DATA, 0x0800U);          
  /* DAC_MAXVAL: MAXVAL=0 */
  setReg16(DAC_MAXVAL, 0x00U);          
  /* DAC_MINVAL: MINVAL=0 */
  setReg16(DAC_MINVAL, 0x00U);          
  /* DAC_STEP: STEP=0 */
  setReg16(DAC_STEP, 0x00U);            
  /* DAC_CTRL: PDN=0 */
  clrReg16Bits(DAC_CTRL, 0x01U);        
}
Beispiel #3
0
/*
** ===================================================================
**     Method      :  FC321_Init (bean FreeCntr32)
**
**     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 FC321_Init(void)
{
  TTicks = 0;                          /* Counter of timer ticks */
  TOvf = FALSE;                        /* Counter overflow flag */
  /* TC7: BIT15=0,BIT14=0,BIT13=0,BIT12=0,BIT11=0,BIT10=0,BIT9=0,BIT8=0,BIT7=0,BIT6=1,BIT5=0,BIT4=0,BIT3=1,BIT2=1,BIT1=1,BIT0=1 */
  setReg16(TC7, 79);                   /* Store given value to the compare register */ 
}
Beispiel #4
0
/*
** ===================================================================
**     Method      :  Servo2_Init (bean PWM)
**
**     Description :
**         Initializes the associated peripheral(s) and the bean's 
**         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 Servo2_Init(void)
{
  /* PWMCNT23: BIT15=0,BIT14=0,BIT13=0,BIT12=0,BIT11=0,BIT10=0,BIT9=0,BIT8=0,BIT7=0,BIT6=0,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
  setReg16(PWMCNT23, 0);               /* Reset Counter */ 
  /* PWMSDN: PWMIF=1,PWMIE=0,PWMRSTRT=0,PWMLVL=0,??=0,PWM7IN=0,PWM7INL=0,PWM7ENA=0 */
  setReg8(PWMSDN, 128);                /* Emergency shutdown feature settings */ 
  RatioStore = 4964;                   /* Store initial value of the ratio */
  /* PWMDTY23: BIT15=0,BIT14=0,BIT13=0,BIT12=0,BIT11=0,BIT10=1,BIT9=0,BIT8=1,BIT7=1,BIT6=1,BIT5=1,BIT4=0,BIT3=1,BIT2=0,BIT1=1,BIT0=1 */
  setReg16(PWMDTY23, 1515);            /* Store initial value to the duty-compare register */ 
  /* PWMPER23: BIT15=0,BIT14=1,BIT13=0,BIT12=0,BIT11=1,BIT10=1,BIT9=1,BIT8=0,BIT7=0,BIT6=0,BIT5=1,BIT4=0,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
  setReg16(PWMPER23, 20000);           /* and to the period register */ 
  /* PWMPRCLK: ??=0,PCKB2=0,PCKB1=0,PCKB0=0,??=0,PCKA2=0,PCKA1=0,PCKA0=0 */
  setReg8(PWMPRCLK, 0);                /* Set prescaler register */ 
  /* PWMSCLB: BIT7=0,BIT6=0,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=0,BIT0=1 */
  setReg8(PWMSCLB, 1);                 /* Set scale register */ 
  /* PWMCLK: PCLK3=0 */
  clrReg8Bits(PWMCLK, 8);              /* Select clock source */ 
  /* PWME: PWME3=1 */
  setReg8Bits(PWME, 8);                /* Run counter */ 
}
Beispiel #5
0
void _sleepEntryPoint(void)
{	
    /*** ### 56F807 "Cpu" init code ... ***/
  	/* System clock initialization */
	setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC0_MASK)); /* Enable PLL, LCKON and select clock source from prescaler */
	/* CLKOSR: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,CLKOSEL=0 */
	setReg16(CLKOSR, 0);                 /* CLKO = ZCLOCK */ 
	/* PLLDB: LORTP=0,PLLCOD=0,PLLCID=1,??=0,PLLDB=39 */
	setReg16(PLLDB, 295);                /* Set the clock prescalers */ 
	while(!getRegBit(PLLSR, LCK0)){}     /* Wait for PLL lock */
	setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC1_MASK)); /* Select clock source from postscaler */
	/* External bus initialization */
	/* BCR: ??=0,??=0,??=0,??=0,??=0,??=0,DRV=1,??=0,WSX=12,WSP=12 */
	setReg16(BCR, 716);                  /* Bus control register */ 

	asm(move #1,y1)						/* stores y1=1 for jumping
										 * to mySleep after initialization */
	
	asm(jmp init_56800_);               /* Jump to C startup code */
}
Beispiel #6
0
void _EntryPoint(void)
{
  /* ### MC9S08PA16_32 "Cpu" init code ... */
  /*  PE initialization code after reset */
  /* WDOG_CNT: CNT=0xC520 */
  setReg16(WDOG_CNT, 0xC520U);         /* First part of the WDG unlock sequence */ 
  /* WDOG_CNT: CNT=0xD928 */
  setReg16(WDOG_CNT, 0xD928U);         /* Second part of the WDG unlock sequence */ 
  /*  Initialization of Init_WDOG */
  /* WDOG_CS1: EN=1,INT=0,UPDATE=1,TST=0,DBG=0,WAIT=1,STOP=1 */
  setReg8(WDOG_CS1, 0xA3U);             
  /* WDOG_CS2: WIN=0,FLG=0,??=0,PRES=1,??=0,??=0,CLK=0 */
  setReg8(WDOG_CS2, 0x10U);             
  /* WDOG_TOVAL: TOVAL=0xF800 */
  setReg16(WDOG_TOVAL, 0xF800U);        
  /* Common initialization of the write once registers */
  /* SYS_SOPT1: SCI0PS=0,BKGDPE=1,RSTPE=1,FWAKE=0,STOPE=0 */
  clrSetReg8Bits(SYS_SOPT1, 0x83U, 0x0CU); 
  /* PMC_SPMSC1: LVWIE=0,LVDRE=1,LVDSE=1,LVDE=1,BGBDS=0,BGBE=0 */
  clrSetReg8Bits(PMC_SPMSC1, 0x23U, 0x1CU); 
  /* PMC_SPMSC2: LVDV=0,LVWV=0 */
  clrReg8Bits(PMC_SPMSC2, 0x70U);       
  /*  System clock initialization */
  /*lint -save  -e923 Disable MISRA rule (11.3) checking. */
  if (*(uint8_t*)0xFF6FU != 0xFFU) {   /* Test if the device trim value is stored on the specified address */
    ICS_C3 = *(uint8_t*)0xFF6FU;       /* Initialize ICS_C3 register from a non volatile memory */
    ICS_C4 = (uint8_t)((*(uint8_t*)0xFF6EU) & (uint8_t)0x01U); /* Initialize ICS_C4 register from a non volatile memory */
  }
  /*lint -restore Enable MISRA rule (11.3) checking. */
  /* ICS_C1: CLKS=0,RDIV=0,IREFS=1,IRCLKEN=1,IREFSTEN=0 */
  setReg8(ICS_C1, 0x06U);              /* Initialization of the ICS control register 1 */ 
  /* ICS_C2: BDIV=1,LP=0,??=0,??=0,??=0,??=0 */
  setReg8(ICS_C2, 0x20U);              /* Initialization of the ICS control register 2 */ 
  /* ICS_C4: LOLIE=0,CME=0 */
  clrReg8Bits(ICS_C4, 0xA0U);           

  /*** 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. */
}
/*
** ===================================================================
**     Method      :  M_1_Init (component PWM)
**
**     Description :
**         Initializes the associated peripheral(s) and the components 
**         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 M_1_Init(void)
{
  /* TPM1SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  setReg8(TPM1SC, 0x00U);              /* Disable device */ 
  /* TPM1C1SC: CH1F=0,CH1IE=0,MS1B=1,MS1A=1,ELS1B=1,ELS1A=1,??=0,??=0 */
  setReg8(TPM1C1SC, 0x3CU);            /* Set up PWM mode with output signal level low */ 
  ActualRatio.Value = 0xFFFFU;         /* Store initial value of the ratio */
  /* TPM1MOD: BIT15=1,BIT14=1,BIT13=1,BIT12=1,BIT11=0,BIT10=1,BIT9=0,BIT8=1,BIT7=1,BIT6=1,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=1,BIT0=0 */
  setReg16(TPM1MOD, 0xF5C2U);          /* Set modulo register */ 
  SetRatio();                          /* Calculate and set up new values of the compare according to the selected speed CPU mode */
  (void)getReg8(TPM1SC);               /* Dummy read of the TPM1SC register to reset flag */
  /* TPM1SC: TOF=0,TOIE=1 */
  clrSetReg8Bits(TPM1SC, 0x80U, 0x40U); /* Clear Overflow interrupt flag and enable Overflow interrupt */ 
}
/*
** ===================================================================
**     Method      :  MotorD1_Init (component PWM)
**
**     Description :
**         Initializes the associated peripheral(s) and the components 
**         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 MotorD1_Init(void)
{
  /* TPM3SC: TOF=0,TOIE=0,CPWMS=0,CLKSB=0,CLKSA=0,PS2=0,PS1=0,PS0=0 */
  setReg8(TPM3SC, 0x00U);              /* Disable device */ 
  /* TPM3C0SC: CH0F=0,CH0IE=0,MS0B=1,MS0A=1,ELS0B=1,ELS0A=0,??=0,??=0 */
  setReg8(TPM3C0SC, 0x38U);            /* Set up PWM mode with output signal level high */ 
  ActualRatio = 0x00U;                 /* Store initial value of the ratio */
  EnUser = FALSE;                      /* Disable device */
  /* TPM3MOD: BIT15=0,BIT14=1,BIT13=1,BIT12=0,BIT11=0,BIT10=0,BIT9=1,BIT8=0,BIT7=0,BIT6=1,BIT5=0,BIT4=0,BIT3=1,BIT2=1,BIT1=0,BIT0=1 */
  setReg16(TPM3MOD, 0x624DU);          /* Set modulo register */ 
  /* TPM3C0SC: CH0F=0,CH0IE=0,MS0B=1,MS0A=0,ELS0B=0,ELS0A=0,??=0,??=0 */
  setReg8(TPM3C0SC, 0x20U);            /* Temporary set compare mode to enable modifications of compare register */ 
  SetRatio();                          /* Calculate and set up new values of the compare according to the selected speed CPU mode */
  HWEnDi();                            /* Enable/disable device according to status flags */
}
Beispiel #9
0
/*
** ===================================================================
**     Method      :  PWMC1_Init (component PWMMC)
**
**     Description :
**         Initializes the associated peripheral(s) and the bean 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 PWMC1_Init(void)
{
  /* PWM_PMCTL: LDFQ=0,HALF=0,IPOL2=0,IPOL1=0,IPOL0=0,PRSC=0,PWMRIE=0,PWMF=0,??=0,??=0,LDOK=0,PWMEN=0 */
  setReg16(PWM_PMCTL, 0U);             /* Set up PWM control register */ 
  /* PWM_PMFCTL: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,FIE3=0,FMODE3=1,FIE2=0,FMODE2=1,FIE1=0,FMODE1=1,FIE0=0,FMODE0=1 */
  setReg16(PWM_PMFCTL, 85U);           /* Set up Fault Control Register */ 
  /* PWM_PMICCR: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,ICC2=0,ICC1=0,ICC0=0 */
  setReg16(PWM_PMICCR, 0U);            /* Set up Internal Correction Control Register */ 
  /* PWM_PMDISMAP1: DISMAP=0 */
  setReg16(PWM_PMDISMAP1, 0U);          
  /* PWM_PMDISMAP2: ??=0,??=0,??=0,??=0,??=0,??=0,??=0,??=0,DISMAP=0 */
  setReg16(PWM_PMDISMAP2, 0U);          
  /* PWM_PMOUT: PAD_EN=1,??=0,OUTCTL=0,??=0,??=0,OUT=0 */
  setReg16(PWM_PMOUT, 32768U);          
  /* PWM_PMCCR: ENHA=0,nBX=0,MSK=0,??=0,??=0,VLMODE=0,??=0,SWP45=0,SWP23=0,SWP01=0 */
  setReg16(PWM_PMCCR, 0U);              
  /* PWM_PMSRC: ??=0,??=0,CINV5=0,CINV4=0,CINV3=0,CINV2=0,CINV1=0,CINV0=0,SRC2=0,SRC1=0,SRC0=0 */
  setReg16(PWM_PMSRC, 0U);              
  /* PWM_PMDEADTM0: ??=0,??=0,??=0,??=0,PWMDT0=0 */
  setReg16(PWM_PMDEADTM0, 0U);          
  /* PWM_PMDEADTM1: ??=0,??=0,??=0,??=0,PWMDT1=0 */
  setReg16(PWM_PMDEADTM1, 0U);          
  /* PWM_PWMVAL0: VAL=800 */
  setReg16(PWM_PWMVAL0, 800U);          
  /* PWM_PWMVAL1: VAL=800 */
  setReg16(PWM_PWMVAL1, 800U);          
  /* PWM_PWMVAL2: VAL=800 */
  setReg16(PWM_PWMVAL2, 800U);          
  /* PWM_PWMVAL3: VAL=800 */
  setReg16(PWM_PWMVAL3, 800U);          
  /* PWM_PWMCM: ??=0,CM=1600 */
  setReg16(PWM_PWMCM, 1600U);           
  /* PWM_PMCFG: ??=0,DBG_EN=0,WAIT_EN=0,EDG=0,??=0,TOPNEG45=0,TOPNEG23=0,TOPNEG01=0,??=0,BOTNEG45=0,BOTNEG23=0,BOTNEG01=0,INDEP45=0,INDEP23=1,INDEP01=1,WP=0 */
  setReg16(PWM_PMCFG, 6U);             /* Set up PWM configure register */ 
  /* PWM_PMCTL: LDOK=1 */
  setReg16Bits(PWM_PMCTL, 2U);         /* Load counter and modulo registers into buffers */ 
  /* PWM_PMCTL: PWMEN=1 */
  setReg16Bits(PWM_PMCTL, 1U);         /* Run counter */ 
  /* PWM_PMCTL: PWMF=1 */
  setReg16Bits(PWM_PMCTL, 16U);        /* Clear reload flag made by PWMEN bit */ 

}
Beispiel #10
0
/*
** ===================================================================
**     Method      :  PE_low_level_init (component MC9S08PA16_32)
**
**     Description :
**         Initializes components and provides common register 
**         initialization. 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 PE_low_level_init(void)
{
  #ifdef PEX_RTOS_INIT
    PEX_RTOS_INIT();                   /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */
  #endif
  /* SCG_C1: FTM2=1,??=0,FTM0=1,??=0,??=0,??=0,MTIM0=1,RTC=1 */
  setReg8(SCG_C1, 0xA3U);               
  /* SCG_C2: ??=0,??=0,DBG=1,NVM=1,IPC=1,CRC=1,??=0,??=0 */
  setReg8(SCG_C2, 0x3CU);               
  /* SCG_C3: ??=0,??=0,SCI1=1,SCI0=1,??=0,SPI0=1,IIC=1,??=0 */
  setReg8(SCG_C3, 0x36U);               
  /* SCG_C4: ACMP=1,??=0,ADC=1,??=0,IRQ=1,??=0,??=0,KBI0=1 */
  setReg8(SCG_C4, 0xA9U);               
  /* Common initialization of the CPU registers */
  /* SYS_SOPT2: TXDME=0 */
  clrReg8Bits(SYS_SOPT2, 0x80U);        
  /* PORT_PTBOE: PTBOE1=1,PTBOE0=0 */
  clrSetReg8Bits(PORT_PTBOE, 0x01U, 0x02U); 
  /* PORT_PTBIE: PTBIE1=0,PTBIE0=1 */
  clrSetReg8Bits(PORT_PTBIE, 0x02U, 0x01U); 
  /* PORT_PTBD: PTBD1=1 */
  setReg8Bits(PORT_PTBD, 0x02U);        
  /* PORT_PTCOE: PTCOE7=1,PTCOE6=0 */
  clrSetReg8Bits(PORT_PTCOE, 0x40U, 0x80U); 
  /* PORT_PTCIE: PTCIE7=0,PTCIE6=1 */
  clrSetReg8Bits(PORT_PTCIE, 0x80U, 0x40U); 
  /* PORT_PTCD: PTCD7=1 */
  setReg8Bits(PORT_PTCD, 0x80U);        
  /* PORT_PTAD: PTAD0=0 */
  clrReg8Bits(PORT_PTAD, 0x01U);        
  /* PORT_PTAPE: PTAPE0=0 */
  clrReg8Bits(PORT_PTAPE, 0x01U);       
  /* PORT_PTAOE: PTAOE0=1 */
  setReg8Bits(PORT_PTAOE, 0x01U);       
  /* PORT_PTAIE: PTAIE0=0 */
  clrReg8Bits(PORT_PTAIE, 0x01U);       
  /* PORT_PTDD: PTDD0=0 */
  clrReg8Bits(PORT_PTDD, 0x01U);        
  /* PORT_PTDPE: PTDPE0=0 */
  clrReg8Bits(PORT_PTDPE, 0x01U);       
  /* PORT_PTDOE: PTDOE0=1 */
  setReg8Bits(PORT_PTDOE, 0x01U);       
  /* PORT_PTDIE: PTDIE0=0 */
  clrReg8Bits(PORT_PTDIE, 0x01U);       
  /* SYS_SOPT3: CLKOE=0,BUSREF=0 */
  clrReg8Bits(SYS_SOPT3, 0x0FU);        
  /* IPC_ILRS9: ILRn3=0,ILRn2=0,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS9, 0x00U);            
  /* IPC_ILRS8: ILRn3=0,ILRn2=0,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS8, 0x00U);            
  /* IPC_ILRS7: ILRn3=0,ILRn2=0,ILRn1=0,ILRn0=2 */
  setReg8(IPC_ILRS7, 0x02U);            
  /* IPC_ILRS6: ILRn3=2,ILRn2=2,ILRn1=2,ILRn0=2 */
  setReg8(IPC_ILRS6, 0xAAU);            
  /* IPC_ILRS5: ILRn3=2,ILRn2=0,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS5, 0x80U);            
  /* IPC_ILRS4: ILRn3=2,ILRn2=0,ILRn1=2,ILRn0=2 */
  setReg8(IPC_ILRS4, 0x8AU);            
  /* IPC_ILRS3: ILRn3=0,ILRn2=0,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS3, 0x00U);            
  /* IPC_ILRS2: ILRn3=0,ILRn2=0,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS2, 0x00U);            
  /* IPC_ILRS1: ILRn3=2,ILRn2=2,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS1, 0xA0U);            
  /* IPC_ILRS0: ILRn3=0,ILRn2=0,ILRn1=0,ILRn0=0 */
  setReg8(IPC_ILRS0, 0x00U);            
  /* IPC_SC: IPCE=1,??=0,PSE=0,PSF=0,PULIPM=0,??=0,IPM=0 */
  setReg8(IPC_SC, 0x80U);               
      /* Initialization of the PORT module */
  /* ### Shared modules init code ... */
  /* ### Asynchro serial "AS_CCTALK" init code ... */
  AS_CCTALK_Init();
  /* ### Free running 8-bit counter "FC_CCTALK" init code ... */
  FC_CCTALK_Init();
  /* ### TimerInt "TI_CCTALK" init code ... */
  TI_CCTALK_Init();
  /* ###  WatchDog "WDOG" init code ... */
  WDOG_Init();
  /* WDOG_CNT: CNT=0xA602 */
  setReg16(WDOG_CNT, 0xA602U);          
  /* WDOG_CNT: CNT=0xB480 */
  setReg16(WDOG_CNT, 0xB480U);          
  /* ### Asynchro serial "AS_DATABUS" init code ... */
  AS_DATABUS_Init();
  /* ### BitIO "LED_RUN" init code ... */
  /* ### BitIO "LED_CCTALK" init code ... */
  /* ### Free running 8-bit counter "FC_DATABUS" init code ... */
  FC_DATABUS_Init();
  /* ### TimerInt "TI_LEDS" init code ... */
  TI_LEDS_Init();
  /* ### IntEEPROM "EEPROM" init code ... */
  EEPROM_Init();
  /* ### Free running 8-bit counter "FC_HOPPER" init code ... */
  FC_HOPPER_Init();
  /* Common peripheral initialization - ENABLE */
  /* FTM0_SC: CLKS=1 */
  clrSetReg8Bits(FTM0_SC, 0x10U, 0x08U); 
  /* FTM2_SC: CLKS=1 */
  clrSetReg8Bits(FTM2_SC, 0x10U, 0x08U); 
  CCR_lock = (byte)0;
  __EI();                              /* Enable interrupts */
}
Beispiel #11
0
/*
** ===================================================================
**     Method      :  PE_low_level_init (bean MC9S12DG128_112)
**
**     Description :
**         Initializes beans and provides common register initialization. 
**         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 PE_low_level_init(void)
{
  /* Common initialization of the CPU registers */
  /* PIEP: PIEP5=0 */
  clrReg8Bits(PIEP, 32);                
  /* PTP: PTP5=0,PTP4=0,PTP3=0,PTP1=0 */
  clrReg8Bits(PTP, 58);                 
  /* PERP: PERP5=0 */
  clrReg8Bits(PERP, 32);                
  /* DDRP: DDRP5=1,DDRP4=1,DDRP3=1,DDRP1=1 */
  setReg8Bits(DDRP, 58);                
  /* PEAR: NOACCE=0,PIPOE=0,NECLK=1,LSTRE=0,RDWE=0 */
  clrSetReg8Bits(PEAR, 172, 16);        
  /* PUCR: PUPKE=0,PUPEE=0,PUPBE=0,PUPAE=0 */
  clrReg8Bits(PUCR, 147);               
  /* DDRE: BIT7=0,BIT6=0,BIT5=0,BIT4=0,BIT3=0,BIT2=0 */
  clrReg8Bits(DDRE, 252);               
  /* PTM: PTM4=0,PTM3=0 */
  clrReg8Bits(PTM, 24);                 
  /* WOMM: WOMM4=0,WOMM3=0 */
  clrReg8Bits(WOMM, 24);                
  /* DDRM: DDRM4=1,DDRM3=1 */
  setReg8Bits(DDRM, 24);                
  /* PERM: PERM4=0 */
  clrReg8Bits(PERM, 16);                
  /* PORTK: BIT3=0,BIT0=0 */
  clrReg8Bits(PORTK, 9);                
  /* DDRK: BIT3=1,BIT0=1 */
  setReg8Bits(DDRK, 9);                 
  /* PTS: PTS1=1 */
  setReg8Bits(PTS, 2);                  
  /* DDRS: DDRS1=1,DDRS0=0 */
  clrSetReg8Bits(DDRS, 1, 2);           
  /* PWME: PWME7=0,PWME6=0,PWME5=0,PWME4=0,PWME3=0,PWME2=0,PWME1=0,PWME0=0 */
  setReg8(PWME, 0);                     
  /* PWMCTL: CON45=0,CON23=1,CON01=1,PSWAI=0,PFRZ=0 */
  clrSetReg8Bits(PWMCTL, 76, 48);       
  /* PWMCAE: CAE4=0,CAE3=0,CAE1=0 */
  clrReg8Bits(PWMCAE, 26);              
  /* PWMPOL: PPOL4=0,PPOL3=0,PPOL1=0 */
  clrReg8Bits(PWMPOL, 26);              
  /* PBCTL: PBEN=0 */
  clrReg8Bits(PBCTL, 64);               
  /* TSCR1: TEN=0,TSWAI=0,TSFRZ=0,TFFCA=0 */
  clrReg8Bits(TSCR1, 240);              
  /* DLYCT: ??=0,??=0,??=0,??=0,??=0,??=0,DLY1=0,DLY0=0 */
  setReg8(DLYCT, 0);                    
  /* ICSYS: SH37=0,SH26=0,SH15=0,SH04=0,TFMOD=0,PACMX=0,BUFEN=0,LATQ=0 */
  setReg8(ICSYS, 0);                    
  /* ICOVW: NOVW7=0,NOVW5=0,NOVW0=0 */
  clrReg8Bits(ICOVW, 161);              
  /* TCTL4: EDG0B=1,EDG0A=1 */
  setReg8Bits(TCTL4, 3);                
  /* TCTL3: EDG7B=0,EDG7A=0,EDG5B=0,EDG5A=0 */
  clrReg8Bits(TCTL3, 204);              
  /* TIOS: IOS7=0,IOS5=0,IOS0=0 */
  clrReg8Bits(TIOS, 161);               
  /* PERT: PERT7=0,PERT5=0,PERT0=0 */
  clrReg8Bits(PERT, 161);               
  /* PORTA: BIT7=0,BIT6=0,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
  setReg8(PORTA, 0);                    
  /* DDRA: BIT7=1,BIT6=1,BIT5=1,BIT4=1,BIT3=1,BIT2=1,BIT1=1,BIT0=1 */
  setReg8(DDRA, 255);                   
  /* PORTB: BIT7=0,BIT6=0,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
  setReg8(PORTB, 0);                    
  /* DDRB: BIT7=1,BIT6=1,BIT5=1,BIT4=1,BIT3=1,BIT2=1,BIT1=1,BIT0=1 */
  setReg8(DDRB, 255);                   
  /* TIE: C7I=0,C5I=0 */
  clrReg8Bits(TIE, 160);                
  /* PACTL: CLK1=0,CLK0=0 */
  clrReg8Bits(PACTL, 12);               
  /* ATD0DIEN: IEN0=0 */
  clrReg8Bits(ATD0DIEN, 1);             
  /* ATD1DIEN: IEN0=0 */
  clrReg8Bits(ATD1DIEN, 1);             
  /* CRGINT: LOCKIE=0,SCMIE=0 */
  clrReg8Bits(CRGINT, 18);              
  /* COPCTL: RSBCK=0 */
  clrReg8Bits(COPCTL, 64);              
  /* RDRIV: RDPK=0,RDPE=0,RDPB=0,RDPA=0 */
  clrReg8Bits(RDRIV, 147);              
  /* RDRH: RDRH7=0,RDRH6=0,RDRH5=0,RDRH4=0,RDRH3=0,RDRH2=0,RDRH1=0,RDRH0=0 */
  setReg8(RDRH, 0);                     
  /* RDRJ: RDRJ7=0,RDRJ6=0,RDRJ1=0,RDRJ0=0 */
  clrReg8Bits(RDRJ, 195);               
  /* RDRM: RDRM7=0,RDRM6=0,RDRM5=0,RDRM4=0,RDRM3=0,RDRM2=0,RDRM1=0,RDRM0=0 */
  setReg8(RDRM, 0);                     
  /* RDRP: RDRP7=0,RDRP6=0,RDRP5=0,RDRP4=0,RDRP3=0,RDRP2=0,RDRP1=0,RDRP0=0 */
  setReg8(RDRP, 0);                     
  /* RDRS: RDRS7=0,RDRS6=0,RDRS5=0,RDRS4=0,RDRS3=0,RDRS2=0,RDRS1=0,RDRS0=0 */
  setReg8(RDRS, 0);                     
  /* RDRT: RDRT7=0,RDRT6=0,RDRT5=0,RDRT4=0,RDRT3=0,RDRT2=0,RDRT1=0,RDRT0=0 */
  setReg8(RDRT, 0);                     
  /* INTCR: IRQEN=0 */
  clrReg8Bits(INTCR, 64);               
  /* PACN10: BIT15=0,BIT14=0,BIT13=0,BIT12=0,BIT11=0,BIT10=0,BIT9=0,BIT8=0,BIT7=0,BIT6=0,BIT5=0,BIT4=0,BIT3=0,BIT2=0,BIT1=0,BIT0=0 */
  setReg16(PACN10, 0);                  
  /* ### MC9S12DG128_112 "Cpu112" init code ... */
  /* ### BitIO "ForwardOrBackward" init code ... */
  /* ### ByteIO "E" init code ... */
  /* ### BitIO "MotorEnableM3" init code ... */
  /* ### BitIO "M4" init code ... */
  Shadow_M &= (byte)~16;               /* Initialize pin shadow variable bit */
  /* ### BitIO "K0" init code ... */
  Shadow_K &= (byte)~1;                /* Initialize pin shadow variable bit */
  /* ### BitIO "MotorEnableK3" init code ... */
  /* ### Asynchro serial "SCI" init code ... */
  SCI_Init();
  /* ### Programable pulse generation "Servo1" init code ... */
  Servo1_Init();
  /* ### Programable pulse generation "Servo2" init code ... */
  Servo2_Init();
  /* ### Programable pulse generation "MainMotor" init code ... */
  MainMotor_Init();
  /* ### PulseAccumulator "SpeedSensor" init code ... */
  SpeedSensor_Init();
  /* ### ByteIO "PORTA" init code ... */
  /* ### ByteIO "PORTB" init code ... */
  /* ### Timer capture encapsulation "Cap1" init code ... */
  Cap1_Init();
  /* ### Timer capture encapsulation "Cap2" init code ... */
  Cap2_Init();
  /* ###  "ATC0" init code ... */
  ATC0_Init();
  /* ###  "ATC1" init code ... */
  ATC1_Init();
 /* Common peripheral initialization - ENABLE */
  /* TSCR1: TEN=1 */
  setReg8Bits(TSCR1, 128);              
  __EI();                              /* Enable interrupts */
}