Message Edited by bigmac on 2007-02-2712:48 AM
/* Disable the Cop and the LVI module power */ // CONFIG1_COPD = 1; // CONFIG1_LVIPWRD = 1; //SOPT_COPE=0; // SRS_COP=0; // SRS_LVD=0; SOPT_COPE=0; SPMSC1_LVDE=0; /* Using the External Crystal Oscilator. Wich frecuency is Fxtal=9.9804MHz */ // CONFIG2_OSCCLK0=0; //CONFIG2_OSCCLK1=1; //ICGC1_OSCSTEN=0; // ICGC1_REFS=1; // ICGC1_CLKS=10; ICGC1_RANGE=1; ICGC1_CLKS1=1; ICGC1_CLKS0=1;
void TimerInit(void){ TPM1SC_TOIE = 1; /* Enable overflow interrupt*/ TPM1SC_CLKSB = 0; TPM1SC_CLKSA = 1; TPM1SC_PS0 = 0; /* Select prescale divisor. Preescaler = 1 */ TPM1SC_PS1 = 0; TPM1SC_PS2 = 1; TPM1MOD = 0x01f3; /* For an overflow interrupt of aprox 100 us, this need */ /* 499counts because each count take 1 Tbus, so */ /* (499 * 1Tbus) = 100.09us */ //TPM1SC_CPWMS = 1; /* For normal operation */ // TPM1SC_TOF = 1;}
Message Edited by sonu on 2007-02-2802:11 PM