sleep was the first routine setup for this project
Code:=========== Power Shutdown routine ================== Shut_Down: pwr_on = 1 ' PWR ON = 1 = OFF - turns off power to devices external to cpu @ INT_DISABLE RBC_INT ; TURN OFF PortB IOC Interrupts for RX_mode - RF_IRQ pin @ INT_DISABLE RX2_INT ; Turn Off USART RX Interrupts for RX_mode - RX input on USART @ INT_DISABLE TMR0_INT ; disable Timer0 interupts gosub RF_Powerdown ' shut down rf module TRISA = $FF ' reduce power usage by puting port to inputs TRISC = $FF TRISD = $F7 ' make all ports inputs except portd.3 for PWR_ON output TRISE = $FF WPUB = $00 ' Port B set to inputs already , turn off all week pullups PMD0 = $FF ' TURN OFF ALL PERIPHERALS ON CPU PMD1 = $FF PMD2 = $FF PWR_shutdown = 0 ' CLEAR shutdown flag INTCON.1 = 0 ' CLEAR INT0 interupt flag prior to enable @ INT_ENABLE INT0_INT ; Enable INT0 interupt to allow wakeup from Sleep command - Triggered by PWR_SW , active Low OSCCON.7 =0 ' clear IDLEN bit ready for sleep command @ sleep ; sleep command @ NOP return




Bookmarks