void tim2_init(int regime) { float period; static int initialized = 0; if (regime < 300) { initialized = 0; // Initialisation à faire CpuTimer2Regs.TCR.bit.TSS = 1; // Stop le timer 2 } else { period = 120*(1000000/(float)regime); // Lance le timer en mode auto-reload if(initialized == 0) { // Configure CPU-Timer 0 to interrupt every (period/1000000) second: // 80MHz CPU Freq, period (in uSeconds) ConfigCpuTimer(&CpuTimer2, 80, period); // Initialize the EPWM module : InitEPwmTimer(); initialized = 1; } Freq_ind = 1000000/period; } }