//----- GO TO SLEEP -----

	//Do anything you need to reduce power before you sleep
			
	//Setup IRQ pins that will wake us when a button is pressed
	INTERRUPT_GlobalInterruptDisable();
	IOCBN = 0b00111000;		//RB5:R3 will wake us when any is pulled low
	IOCBF = 0x00;			//Clear any IOC occurred flags
	INTCONbits.IOCIE = 1;		//Enable Interrupt On Change interrupts (we won't actually jump to an IRQ handler)

	//GO TO SLEEP HERE
	SLEEP();

	//--- WOKEN UP FROM SLEEP ---
	IOCBN = 0x00;				//Clear Interrupt On Change IRQ enables
	INTCONbits.IOCIE = 0;
	INTERRUPT_GlobalInterruptEnable();
			
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 *