PIC24FJ256GB106


	//----- SETUP TIMER 2 -----
	//Used for: PWM
	T2CON = 0x0000;			//16 bit, 1:1 prescale
	TMR2 = 0;
	PR2 = 0x0fff;			//<This sets the PWM resolution

	//----- OC1 -----
	//Used for: Intensity PWM
	OC1CON1 = 0x0000;				//Turn off Output Compare 1 Module
	OC1R = 0x0000;					//Initial PWM period
	OC1RS = 0x0000;					//Set PWM period
	OC1CON1 = 0x0007;				//Timer 2, no fault pin, centre aligned
	T2CONbits.TON = 1;

	//OC1RS = 0x0000;				//<<< Load this with the required PWM value, 0 - PR2
USEFUL?
We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.

Comments

Your email address will not be published. Required fields are marked *