#include <S12e128bits.h> #include <mc9s12e128.h> #include "Pins.h" #include <stdio.h> void ReloadPWMInit(void) { PWME |= (_S12_PWME4); //enable PWM4 PWMPRCLK |= (CLOCK_A_PRESCALER); // divide by 64 PWMPOL |= _S12_PPOL4; //Output Initially high PWMSCLA = CLOCK_A_SCALER; //SA clock scaler, scale by 75 PWMCLK |= (CLOCK_RELOAD); //SA clock selected PWMPER4 = 100; //period of 100 ticks RELOAD_DUTY = RELOAD_OFF_DUTY; //Duty cycle of 0 => off state printf("Init Reload \n\r"); } void TurnOnReloadIR(void){ RELOAD_DUTY = RELOAD_ON_DUTY; puts("ReloadIR ON \n\r"); } void TurnOffReloadIR(void){ RELOAD_DUTY = RELOAD_OFF_DUTY; puts("ReloadIR OFF \n\r"); }