/* ** =================================================================== ** Method : PE_low_level_init (component MC9S08SH8_20) ** ** 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 */ /* PTCD: PTCD0=0 */ clrReg8Bits(PTCD, 0x01); /* PTCPE: PTCPE0=0 */ clrReg8Bits(PTCPE, 0x01); /* PTCDD: PTCDD0=1 */ setReg8Bits(PTCDD, 0x01); /* PTAPE: PTAPE5=0,PTAPE0=0 */ clrReg8Bits(PTAPE, 0x21); /* PTADD: PTADD5=0,PTADD0=0 */ clrReg8Bits(PTADD, 0x21); /* PTBPE: PTBPE6=0 */ clrReg8Bits(PTBPE, 0x40); /* PTBDD: PTBDD6=0 */ clrReg8Bits(PTBDD, 0x40); /* PTASE: PTASE4=0,PTASE3=0,PTASE2=0,PTASE1=0,PTASE0=0 */ clrReg8Bits(PTASE, 0x1F); /* PTBSE: PTBSE7=0,PTBSE6=0,PTBSE5=0,PTBSE4=0,PTBSE3=0,PTBSE2=0,PTBSE1=0,PTBSE0=0 */ setReg8(PTBSE, 0x00); /* PTCSE: PTCSE3=0,PTCSE2=0,PTCSE1=0,PTCSE0=0 */ clrReg8Bits(PTCSE, 0x0F); /* PTADS: ??=0,??=0,??=0,PTADS4=1,PTADS3=1,PTADS2=1,PTADS1=1,PTADS0=1 */ setReg8(PTADS, 0x1F); /* PTBDS: PTBDS7=1,PTBDS6=1,PTBDS5=1,PTBDS4=1,PTBDS3=1,PTBDS2=1,PTBDS1=1,PTBDS0=1 */ setReg8(PTBDS, 0xFF); /* PTCDS: ??=0,??=0,??=0,??=0,PTCDS3=1,PTCDS2=1,PTCDS1=1,PTCDS0=1 */ setReg8(PTCDS, 0x0F); /* ### Shared modules init code ... */ /* ### BitIO "Bit1" init code ... */ /* ### Timer capture encapsulation "Cap1" init code ... */ Cap1_Init(); /* ### TimerInt "TI1" init code ... */ TI1_Init(); /* ### External interrupt "EInt1" init code ... */ /* IRQSC: ??=0,IRQPDD=1,IRQEDG=0,IRQPE=1,IRQF=0,IRQACK=0,IRQIE=0,IRQMOD=1 */ IRQSC = 0x51; IRQSC_IRQACK = 0x01; IRQSC_IRQIE = 0x01; /* ### BitIO "Bit2" init code ... */ /* ### Init_FLASH "FLASH1" init code ... */ FLASH1_Init(); __EI(); /* Enable interrupts */ }
/* ** =================================================================== ** Method : CapturadorTI7_DefConstructor ** Description : Constructor de la clase ** =================================================================== */ void CapturadorTI7_Constructor(void*_self){ struct CapturadorTI7 *_cap= (struct CapturadorTI7 *)_self; Cap1_Init(); }
/* ** =================================================================== ** 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 */ }