PDA

View Full Version : PIC Power saving



comwarrior
- 18th December 2010, 01:08
I just spent a couple of hours going through the device registers to find the 'enable' bits for all the on-chip hardware on the 18F4550.

By disabling the hardware your not using you save power. This will probably be irrelevant to most people, but for those of us that run PIC's from batteries it may be helpful.

The settings below are for the 18F4550, however, i have included the individual bit names so that people can look them up in the datasheet for their PIC.

Hopefully,someone will find this useful...



' shut down chip hardware
'CCP
CCP2CON.0 = 0 'CCP2M0
CCP2CON.1 = 0 'CCP2M1
CCP2CON.2 = 0 'CCP2M2
CCP2CON.3 = 0 'CCP2M3

'ECCP
CCP1CON.0 = 0 'CCP1M0
CCP1CON.1 = 0 'CCP1M1
CCP1CON.2 = 0 'CCP1M2
CCP1CON.3 = 0 'CCP1M3

'USB
UCON.1 = 1 'SUSPND
UCON.2 = 0 'RESUME
UCON.3 = 0 'USBEN

'SPP
SPPCON.0 = 0 'SPPEN

'MSSP
SSPCON1.5 = 0 'SSPEN

'EUSART
BAUDCON.1 = 0 'WUE
TXSTA.5 = 0 'TXEN
RCSTA.7 = 0 'SPEN

'ADC
ADCON0.0 = 0 'ADON

'Comperators
CMCON.0 = 0 'CM0
CMCON.1 = 0 'CM1
CMCON.2 = 0 'CM2

'Comperator Vref
CVRCON.7 = 0 'CVREN
CVRCON.6 = 0 'CVROE

'HLVD
HLVDCON.4 = 0 'HLVDEN

' Timers
T0CON.7 = 0 'TMR0ON
T1CON.0 = 0 'TMR1ON
T2CON.2 = 0 'TMR2ON
T3CON.0 = 0 'TMR3ON