void main(void) { CPU_INT8U speicher=0,i=0,dontprg=0,timeout_sec=0,timeout_ms=0,temp_timer=0; CPU_INT16U pwm_X=0,pwm_Y=0,crc=0; CPU_INT16U angle_X_real=0,angle_Y_real=0; CPU_INT16U average_temp=123,min=2000,max=0; CPU_INT8U temp_average[8]={123,123,123,123,123,123,123,123}; DDRA_DDRA6=1; /* LED - OUT */ LED=1; /* 280ms with internal OSC - 900ms with X-tal */ CPU_INIT(); /* 270ms */´......................................../* 32,768kHz Quarz */const volatile MORSTR _MOR @0x0000FFCF = { 0xFF };/* MOR: OSCSEL1=0,OSCSEL0=1 *///const volatile MORSTR _MOR @0x0000FFCF = { 0x7F };void CPU_INIT (void){ /* internal OSC */ /* CONFIG1 = 17; // Set the CONFIG1 register // CONFIG2: STOPICLKEN=1,STOPRCLKEN=0,STOPXCLKEN=0, // OSCCLK1=0,OSCCLK0=0,—–=0,˜™=0,SCIBDsrc=1 CONFIG2 = 129; // Set the CONFIG2 register PCTL_BCS = 0; // Select clock source from XTAL PCTL_PLLON = 0; // Disable the PLL PMS = 727; // Set the multiplier PMRS = 208; // Set the range select PCTL = 0; PCTL_VPR = 1; PBWC = 128; // Select the operating modes PCTL_PLLON = 1; // Enable the PLL while(!PBWC_LOCK); // Wait PCTL_BCS = 1; // Select clock source from PLL __asm("nop"); __asm("nop"); */ /* 32,768kHz Quarz*/ // CONFIG1: COPRS=0,LVISTOP=0,LVIRSTD=0,LVIPWRD=1,LVIREGD=0,SSREC=0,STOP=0,COPD=1 CONFIG1 = 17; // Set the CONFIG1 register // CONFIG2: STOPICLKEN=0,STOPRCLKEN=0,STOPXCLKEN=0,OSCCLK1=1,OSCCLK0=0,??=0,??=0,SCIBDsrc=1 CONFIG2 = 0x11; // Set the CONFIG2 register //PCTL_BCS = 0; // Select clock source from XTAL PCTL_PLLON = 0; // Disable the PLL PCTL_PLLIE = 0; PCTL_PRE=0; PCTL_VPR=1; PMSH=0x01; PMSL=0xE9; PMRS=0xD1; PMDS=0x01; PBWC = 128; // Select the operating modes "Auto=1" PCTL_PLLON = 1; // Enable the PLL while(!PBWC_LOCK); // Wait PCTL_BCS = 1; // Select clock source from PLL __asm("nop"); __asm("nop");
void main(void) { DDRA_DDRA6=1; /* LED - OUT */ LED=1; /* 280ms with internal OSC - 900ms with X-tal */ CPU_INIT(); /* 270ms */
I think the controller need this time in the startup function, but why need it more time than with the internal oscillator?
I hope anybody can help me!
Roland