/**************************************************************************

PWM01.h header

ME 218B Project Hats Off

Team Firefox

March 7, 2010

This code initializes the PWM for Channel 0 and gives the public functions:

  - initPWM0(unsigned char pol, unsigned char postScale) to initialize PWM

    for Channel 0.

    Polarity and PWM Clock Select are parameters

  - SetPWM0Period(unsigned int period) to set the period

  - SetPWM0DutyCycle(unsigned int dutyCycle) to set the duty cycle.

 

When used in main(), the user still needs to

  - Set the Prescale value

    (ex: PWMPRCLK = (PWMPRCLK &~ _S12_PCKA2) | _S12_PCKA1 | _S12_PCKA0;)

  - Set the Postscale value (ex: PWMSCLA = 75;)

***************************************************************************/

 

/*---------------------------- Include Files ------------------------------*/

#ifndef PWM01_h

 

#define PWM01_h

 

#include <stdio.h>

#include "ME218_E128.h"

//#include <ME218_C32.h>

 

/*---------------------------- Public Function Prototypes -----------------*/

 

//Initializes PWM for Channel 0 and takes in the parameters to determine PWM

//Output Polarity and PWM Clock Select (just prescale or prescale & postscale.)

void PWM0_Init(unsigned char pol, unsigned char postScale);

 

//Set the number of clock counts in one period

void setPWM0Period(unsigned int period);

 

//Set the number of clock counts for the active part of the duty cycle

void setPWM0DutyCycle(unsigned int dutyCycle);

 

 

 

//Initializes PWM for Channel 1 and takes in the parameters to determine PWM

//Output Polarity and PWM Clock Select (just prescale or prescale & postscale.)

void PWM1_Init(unsigned char pol, unsigned char postScale);

 

//Set the number of clock counts in one period

void setPWM1Period(unsigned int period);

 

//Set the number of clock counts for the active part of the duty cycle

void setPWM1DutyCycle(unsigned int dutyCycle);

 

#endif