Dear all,
I am trying out some features in my PIC. I understand that the PIC can be put into various power management modes. I have read through the datasheet. It seems a bit confusing for me to choose the proper mode for my use.
From the various CPU and peripheral clocked combination, I want to apply a proper sleep mode. I am trying to put my PIC into sleep mode from a certain time and then re-activates itself after a certain time has passed (counting presumed by watchdog or Timer1). In a way, it is sort of like an alarm clock or auto-timer. Anyone has any idea on which mode to use or any info to offer?
Thanks. BTW, I am using 18F2525.
Regards,
Liak
Power managmenet modes
Moderators: David Barker, Jerry Messina
Here are the declares I use for the 18F4620 and the GPS Logger I am selling. This code was adapted from a PDS example posted by Bruce from Rentron.
Code: Select all
// Device And CLOCK
Device = 18F2620
Clock = 40
//Device FUSE CONFIG
Config
OSC = HSPLL, // HS Oscillator
FCMEN = OFF, // Failsafe Clock Monitor Disabled
IESO = OFF, // Int/Ext Oscillator Switch Over Disabled
PWRT = OFF, // Power Up Timer Disabled
BOREN = OFF, // Brownout reset Disabled
WDT = OFF, // WATCHDOG Timer Disabled
MCLRE = On, // MCLR Enabled
WDTPS = 256, // 15000 X 4mS = 60 seconds
LVP = OFF, // Low_Voltage Programming
PBADEN = OFF // PORTB Digital
Code: Select all
//*****************************************************************************
Sub PIC_SLEEP(pINTERVAL As Word)
Dim X As Word
If pINTERVAL > 0 Then
If pINTERVAL > 29 Then
GPS_SLEEP()
EndIf
X = pINTERVAL
WDTCON = 1 'Software Enable WDT
Repeat
ASM
Sleep
nop
End ASM
Dec(X)
Until X = 0
WDTCON = 0 'Software Disable WDT
If pINTERVAL > 29 Then
GPS_WAKE()
EndIf
EndIf
End Sub
//*****************************************************************************