void Init_MCPWM(void) { /* Holds the PWM interrupt configuration value*/ unsigned int config;
/* Holds the value to be loaded into dutycycle register */ unsigned int period;
/* Holds the value to be loaded into special event compare register */ unsigned int sptime;
/* Holds PWM configuration value */ unsigned int config1;
/* Holds the value be loaded into PWMCON1 register */ unsigned int config2;
/* Holds the value to configure the special event trigger postscale and dutycycle */ unsigned int config3;
/* The value of ‘dutycyclereg’ determines the duty cycle register(PDCx) to be written */ unsigned int dutycyclereg; unsigned int dutycycle; unsigned char updatedisable; /*以上為變數宣告設定*/ /***************************************/
/* Configure pwm interrupt enable/disable and set interrupt priorties */ config = (PWM_INT_DIS & PWM_FLTA_DIS_INT & PWM_INT_PR1& PWM_FLTA_INT_PR0);
ConfigIntMCPWM( config );
/* Configure PWM to generate square wave of 50% duty cycle */ dutycyclereg = 1;