/*******************************************************************
* FileName:        Problem 1.c
* Processor:       PIC18F4520
* Compiler:        MPLAB C18 v.3.06 
*
* Lab Exam Winter 2008-2009
*                                                                     
*
* Creation and Revisions:
*      Author               Date			Comments
*   David Fisher    
********************************************************************/

/** Header Files ***************************************************/     
#include <p18f4520.h> 
#include <pwm.h>
#include <timers.h>
#include <delays.h>

/** Configuration Bits *********************************************/     
#pragma config OSC = EC  // EC = External 4MHz Crystal for PICDEM board only
#pragma config WDT = OFF
#pragma config LVP = OFF
#pragma config BOREN = OFF

/** Define Constants Here ******************************************/
#define SAMPLE 100
#define HZ_250 249
#define HZ_750 82
#define HZ_500 124

/*******************************************************************
* Function:        void main(void)
********************************************************************/
#pragma code
void main (void)
{
	// This area happens once
	// Good for initializing and things that need to happen once

	OpenTimer2(TIMER_INT_OFF & T2_PS_1_16);
	OpenPWM1(HZ_250);
	SetDCPWM1(102);
	
	// Play 250	
	OpenPWM1(HZ_250);
	Delay10KTCYx(100);
	
	// Play 750
	OpenPWM1(HZ_750);
	Delay10KTCYx(100);
	
	// Play 500
	OpenPWM1(HZ_500);
	Delay10KTCYx(100);
	
	SetDCPWM1(0);
	while (1)
    {
    }
}